HDMI KVM - max recommended combined cable length and is it better to have longer cable from KVM to Monitor or Device to KVM

KVM Model:

HDMI 2.1 4 computers 2 monitors

USB Interface (5-gigabit or 10-gigbit):

10-gigbit


Problem:

I’m planning on rearranging my setup a bit. What would be maximum recommended total HDMI cable length from device to KVM(I saw 3m for DP port, is it the same for HDMI?) ? Should that also count in Thunderbolt dock in case of using one?
Other question would be that in case of total length of cable being 3 m and having 2 cables - 1m and 2m, would it be better to put shorter cable between kvm and monitor or other way around?