Re: [PATCH 07/39] sched: Expose css_tg() and __setscheduler_prio()
From: Peter Zijlstra
Date: Mon Jun 24 2024 - 07:19:56 EST
On Wed, May 01, 2024 at 05:09:42AM -1000, Tejun Heo wrote:
> These will be used by a new BPF extensible sched_class.
>
> css_tg() will be used in the init and exit paths to visit all task_groups by
> walking cgroups.
>
> __setscheduler_prio() is used to pick the sched_class matching the current
> prio of the task. For the new BPF extensible sched_class, the mapping from
> the task configuration to sched_class isn't static and depends on a few
> factors - e.g. whether the BPF progs implementing the scheduler are loaded
> and in a serviceable state. That mapping logic will be added to
> __setscheduler_prio().
>
> When the BPF scheduler progs get loaded and unloaded, the mapping changes
> and the new sched_class will walk the tasks applying the new mapping using
> __setscheduler_prio().
>
> v3: Dropped SCHED_CHANGE_BLOCK() as upstream is adding more generic cleanup
> mechanism.
>
> v2: Expose SCHED_CHANGE_BLOCK() too and update the description.
>
> Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
> Reviewed-by: David Vernet <dvernet@xxxxxxxx>
> Acked-by: Josh Don <joshdon@xxxxxxxxxx>
> Acked-by: Hao Luo <haoluo@xxxxxxxxxx>
> Acked-by: Barret Rhoden <brho@xxxxxxxxxx>
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> ---
> kernel/sched/core.c | 7 +------
> kernel/sched/sched.h | 7 +++++++
> 2 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 9b60df944263..987209c0e672 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -7098,7 +7098,7 @@ int default_wake_function(wait_queue_entry_t *curr, unsigned mode, int wake_flag
> }
> EXPORT_SYMBOL(default_wake_function);
>
> -static void __setscheduler_prio(struct task_struct *p, int prio)
> +void __setscheduler_prio(struct task_struct *p, int prio)
> {
> if (dl_prio(prio))
> p->sched_class = &dl_sched_class;
FWIW this conflicts with patches in tip/sched/core, and did so at the
time of posting.