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] [day] [month] [year] [list]
Message-ID: <ZsZzY0v8xxtzV7_L@slm.duckdns.org>
Date: Wed, 21 Aug 2024 13:08:19 -1000
From: Tejun Heo <tj@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, David Vernet <void@...ifault.com>,
	Ingo Molnar <mingo@...hat.com>, Alexei Starovoitov <ast@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [GIT PULL] sched_ext: Initial pull request for v6.11

Hello,

On Wed, Aug 14, 2024 at 12:53:07AM +0200, Peter Zijlstra wrote:
> On Tue, Aug 13, 2024 at 09:14:18AM -1000, Tejun Heo wrote:
> > Hello, Peter.
> > 
> > On Sat, Aug 10, 2024 at 10:45:42PM +0200, Peter Zijlstra wrote:
> > ...
> > > > It is tricky because the kernel part can't make assumptions about whether
> > > > two tasks are even on the same timeline. In the usual scheduling path, this
> > > > isn't a problem as the decision is made by the BPF scheduler from balance()
> > > > - if it wants to keep running the current task, it doesn't dispatch a new
> > > > one. Otherwise, it dispatches the next task.
> > > 
> > > But I have a question.. don't you clear scx.slice when a task needs to
> > > be preempted? That is, why isn't that condition sufficient to determine
> > > if curr has precedence over the first queued? If curr and it is still
> > > queued and its slice is non-zero, take curr.
> > 
> > scx.slice is used a bit different from other sched classes mostly because
> > there are two layers - the SCX core and the BPF scheduler itself. The BPF
> > scheduler uses scx.slice to tell the SCX core to "don't bother asking about
> > it until the current slice has been exhausted" - ie. it's a way to offload
> > things like tick handling and preemption by higher priority sched classes to
> > SCX core. When scx.slice expires, the BPF scheduler's dispatch() is called
> > which can then decide whether to replenish the slice of the current task or
> > something else should run and so on.
> 
> Right, but can't we flip that on its head and state that when scx.slice
> is non-zero, we should pick current and not bother asking for what's
> next?

I ended up resolving this differently. The existing code distinguishes the
regular and core-sched paths because the current task gets enqueued when
balance_scx() decides to keep running it. With the pending put_prev_task
update, it becomes a lot more straightforward to not queue current when
deciding to keep running it, which makes regular and core-sched paths
identical.

Thanks.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ