[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <549c1cba-5cad-7706-de85-d61376db25cc@linux.com>
Date: Tue, 7 Nov 2023 20:08:03 -0800 (PST)
From: Christoph Lameter <cl@...ux.com>
To: Ankur Arora <ankur.a.arora@...cle.com>
cc: linux-kernel@...r.kernel.org, tglx@...utronix.de,
peterz@...radead.org, torvalds@...ux-foundation.org,
paulmck@...nel.org, linux-mm@...ck.org, x86@...nel.org,
akpm@...ux-foundation.org, luto@...nel.org, bp@...en8.de,
dave.hansen@...ux.intel.com, hpa@...or.com, mingo@...hat.com,
juri.lelli@...hat.com, vincent.guittot@...aro.org,
willy@...radead.org, mgorman@...e.de, jon.grimm@....com,
bharata@....com, raghavendra.kt@....com,
boris.ostrovsky@...cle.com, konrad.wilk@...cle.com,
jgross@...e.com, andrew.cooper3@...rix.com, mingo@...nel.org,
bristot@...nel.org, mathieu.desnoyers@...icios.com,
geert@...ux-m68k.org, glaubitz@...sik.fu-berlin.de,
anton.ivanov@...bridgegreys.com, mattst88@...il.com,
krypton@...ich-teichert.org, rostedt@...dmis.org,
David.Laight@...LAB.COM, richard@....at, mjguzik@...il.com
Subject: Re: [RFC PATCH 00/86] Make the kernel preemptible
The kernel is not preemptible???? What are you smoking?
On Tue, 7 Nov 2023, Ankur Arora wrote:
> In voluntary models, the scheduler's job is to match the demand
> side of preemption points (a task that needs to be scheduled) with
> the supply side (a task which calls cond_resched().)
Voluntary preemption models are important for code optimization because
the code can rely on the scheduler not changing the cpu we are running on.
This allows removing code for preempt_enable/disable to be removed from
the code and allows better code generation. The best performing code is
generated with defined preemption points when we have a guarantee that the
code is not being rescheduled on a different processor. This is f.e.
important for consistent access to PER CPU areas.
> To do this add a new flag, TIF_NEED_RESCHED_LAZY which allows the
> scheduler to mark that a reschedule is needed, but is deferred until
> the task finishes executing in the kernel -- voluntary preemption
> as it were.
That is different from the current no preemption model? Seems to be
the same.
> There's just one remaining issue: now that explicit preemption points are
> gone, processes that spread a long time in the kernel have no way to give
> up the CPU.
These are needed to avoid adding preempt_enable/disable to a lot of
primitives that are used for synchronization. You cannot remove those
without changing a lot of synchronization primitives to always have to
consider being preempted while operating.
Powered by blists - more mailing lists