]> git.baikalelectronics.ru Git - kernel.git/commit
dm mpath selector: more evenly distribute ties
authorKhazhismel Kumykov <khazhy@google.com>
Fri, 19 Jan 2018 23:07:37 +0000 (15:07 -0800)
committerMike Snitzer <snitzer@redhat.com>
Mon, 29 Jan 2018 18:44:58 +0000 (13:44 -0500)
commit508f62d2ab8922b405ed87f366bf6f76bfa419fa
tree03684152f0cc079ad9d21804e2543e47059bb4ab
parent1934c0a544a03b1a3b6f0103d17bc9035c0a24d6
dm mpath selector: more evenly distribute ties

Move the last used path to the end of the list (least preferred) so that
ties are more evenly distributed.

For example, in case with three paths with one that is slower than
others, the remaining two would be unevenly used if they tie. This is
due to the rotation not being a truely fair distribution.

Illustrated: paths a, b, c, 'c' has 1 outstanding IO, a and b are 'tied'
Three possible rotations:
(a, b, c) -> best path 'a'
(b, c, a) -> best path 'b'
(c, a, b) -> best path 'a'
(a, b, c) -> best path 'a'
(b, c, a) -> best path 'b'
(c, a, b) -> best path 'a'
...

So 'a' is used 2x more than 'b', although they should be used evenly.

With this change, the most recently used path is always the least
preferred, removing this bias resulting in even distribution.
(a, b, c) -> best path 'a'
(b, c, a) -> best path 'b'
(c, a, b) -> best path 'a'
(c, b, a) -> best path 'b'
...

Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-queue-length.c
drivers/md/dm-service-time.c