Files
kernel_xiaomi_mt6781/kernel
Peter Oskolkov 53570fa708 sched/fair: Tweak pick_next_entity()
Currently, pick_next_entity(...) has the following structure
(simplified):

  [...]
  if (last_buddy_ok())
    result = last_buddy;
  if (next_buddy_ok())
    result = next_buddy;
  [...]

The intended behavior is to prefer next buddy over last buddy;
the current code somewhat obfuscates this, and also wastes
cycles checking the last buddy when eventually the next buddy is
picked up.

So this patch refactors two 'ifs' above into

  [...]
  if (next_buddy_ok())
      result = next_buddy;
  else if (last_buddy_ok())
      result = last_buddy;
  [...]

Signed-off-by: Peter Oskolkov <posk@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Vincent Guittot <vincent.guitttot@linaro.org>
Link: https://lkml.kernel.org/r/20200930173532.1069092-1-posk@google.com
Signed-off-by: John Vincent <git@tenseventyseven.cf>
2025-10-18 10:51:00 +00:00
..
2019-12-13 08:51:11 +01:00
2020-04-29 19:16:15 +02:00
2025-10-18 10:50:59 +00:00
2025-09-20 03:21:11 +01:00
2020-01-15 14:51:23 +00:00
2020-03-25 08:06:13 +01:00
2019-08-12 13:36:37 -04:00
2021-02-07 14:48:38 +01:00
2020-01-09 10:18:59 +01:00
2019-03-06 15:59:21 +00:00