Re: [PATCH 07/39] sched: Expose css_tg() and __setscheduler_prio()

Peter Zijlstra
2024-06-24T11:19:37Z

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@kernel.org>
> Reviewed-by: David Vernet <dvernet@meta.com>
> Acked-by: Josh Don <joshdon@google.com>
> Acked-by: Hao Luo <haoluo@google.com>
> Acked-by: Barret Rhoden <brho@google.com>
> Reported-by: kernel test robot <lkp@intel.com>
> ---
> 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.