lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 24 Jun 2024 10:59:27 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Tejun Heo <tj@...nel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>, mingo@...hat.com,
	juri.lelli@...hat.com, vincent.guittot@...aro.org,
	dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
	mgorman@...e.de, bristot@...hat.com, vschneid@...hat.com,
	ast@...nel.org, daniel@...earbox.net, andrii@...nel.org,
	martin.lau@...nel.org, joshdon@...gle.com, brho@...gle.com,
	pjt@...gle.com, derkling@...gle.com, haoluo@...gle.com,
	dvernet@...a.com, dschatzberg@...a.com, dskarlat@...cmu.edu,
	riel@...riel.com, changwoo@...lia.com, himadrics@...ia.fr,
	memxor@...il.com, andrea.righi@...onical.com,
	joel@...lfernandes.org, linux-kernel@...r.kernel.org,
	bpf@...r.kernel.org, kernel-team@...a.com
Subject: Re: [PATCH sched_ext/for-6.11] sched, sched_ext: Replace
 scx_next_task_picked() with sched_class->switch_class()

On Thu, Jun 20, 2024 at 12:15:02PM -1000, Tejun Heo wrote:
> scx_next_task_picked() is used by sched_ext to notify the BPF scheduler when
> a CPU is taken away by a task dispatched from a higher priority sched_class
> so that the BPF scheduler can, e.g., punt the task[s] which was running or
> were waiting for the CPU to other CPUs.
> 
> Replace the sched_ext specific hook scx_next_task_picked() with a new
> sched_class operation switch_class().
> 
> The changes are straightforward and the code looks better afterwards.
> However, when !CONFIG_SCHED_CLASS_EXT, this just ends up adding an unused
> hook which is unlikely to be useful to other sched_classes. We can #ifdef
> the op with CONFIG_SCHED_CLASS_EXT but then I'm not sure the code
> necessarily looks better afterwards.
> 
> Please let me know the preference. If adding #ifdef's is preferable, that's
> okay too.
> 
> Signed-off-by: Tejun Heo <tj@...nel.org>
> Suggested-by: Linus Torvalds <torvalds@...ux-foundation.org>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> ---
>  kernel/sched/core.c  |    5 ++++-
>  kernel/sched/ext.c   |   20 ++++++++++----------
>  kernel/sched/ext.h   |    4 ----
>  kernel/sched/sched.h |    2 ++
>  4 files changed, 16 insertions(+), 15 deletions(-)
> 
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5907,7 +5907,10 @@ restart:
>  	for_each_active_class(class) {
>  		p = class->pick_next_task(rq);
>  		if (p) {
> -			scx_next_task_picked(rq, p, class);
> +			const struct sched_class *prev_class = prev->sched_class;
> +
> +			if (class != prev_class && prev_class->switch_class)
> +				prev_class->switch_class(rq, p);
>  			return p;
>  		}
>  	}

I would much rather see sched_class::pick_next_task() get an extra
argument so that the BPF thing can do what it needs in there and we can
avoid this extra code here.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ