[PATCH 0/4] sched/rt: Distribute tasks in find_lowest_rq()

From: Qais Yousef
Date: Tue Apr 14 2020 - 11:06:52 EST


Now that we have a proper function that returns a 'random' CPU in a mask [1]
utilize that in find_lowest_rq() to solve the thundering herd issue described
in this thread

https://lore.kernel.org/lkml/20200219140243.wfljmupcrwm2jelo@e107158-lin/

But as a pre-amble, I noticed that the new cpumask_any_and_distribute() is
actually an alias for cpumask_any_and() which is documented as returning
a 'random' cpu but actually just does cpumask_first_and().

The first 3 patches cleanup the API so that the whole family of
cpumask_any*() take advantage of the new 'random' behavior and in patch
4 I convert the cpumask_first_and() --> cpumask_any_and() in find_lowest_rq()
to allow to better distribute the RT tasks that wake up simultaneously.

[1] https://lore.kernel.org/lkml/20200311010113.136465-1-joshdon@xxxxxxxxxx/

CC: Juri Lelli <juri.lelli@xxxxxxxxxx>
CC: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
CC: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
CC: Steven Rostedt <rostedt@xxxxxxxxxxx>
CC: Ben Segall <bsegall@xxxxxxxxxx>
CC: Mel Gorman <mgorman@xxxxxxx>
CC: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
CC: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
CC: Yury Norov <yury.norov@xxxxxxxxx>
CC: Paul Turner <pjt@xxxxxxxxxx>
CC: Alexey Dobriyan <adobriyan@xxxxxxxxx>
CC: Josh Don <joshdon@xxxxxxxxxx>
CC: Pavan Kondeti <pkondeti@xxxxxxxxxxxxxx>
CC: linux-kernel@xxxxxxxxxxxxxxx

Qais Yousef (4):
cpumask: Rename cpumask_any_and_distribute
cpumask: Make cpumask_any() truly random
cpumask: Convert cpumask_any_but() to the new random function
sched/rt: Better distribute tasks that wakeup simultaneously

include/linux/cpumask.h | 33 ++++++-----------
kernel/sched/core.c | 2 +-
kernel/sched/rt.c | 4 +-
lib/cpumask.c | 82 +++++++++++++++++++++++++++--------------
4 files changed, 68 insertions(+), 53 deletions(-)

--
2.17.1