[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250201180810.1faf4906@batman.local.home>
Date: Sat, 1 Feb 2025 18:08:10 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org, Thomas
Gleixner <tglx@...utronix.de>, Peter Zijlstra <peterz@...radead.org>, Ankur
Arora <ankur.a.arora@...cle.com>, Linus Torvalds
<torvalds@...ux-foundation.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, 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, Joel Fernandes <joel@...lfernandes.org>, Vineeth
Pillai <vineethrp@...gle.com>, Suleiman Souhlal <suleiman@...gle.com>, Ingo
Molnar <mingo@...nel.org>, Clark Williams <clark.williams@...il.com>,
bigeasy@...utronix.de, daniel.wagner@...e.com, joseph.salisbury@...cle.com,
broonie@...il.com
Subject: Re: [RFC][PATCH 1/2] sched: Extended scheduler time slice
On Sat, 1 Feb 2025 15:35:13 +0100
Mathieu Desnoyers <mathieu.desnoyers@...icios.com> wrote:
> On 2025-01-31 23:58, Steven Rostedt wrote:
>
> [...]
>
> > @@ -148,6 +160,18 @@ struct rseq {
> > */
> > __u32 mm_cid;
> >
> > + /*
> > + * The cr_counter is a way for user space to inform the kernel that
> > + * it is in a critical section. If bits 1-31 are set, then the
> > + * kernel may grant the thread a bit more time (but there is no
> > + * guarantee of how much time or if it is granted at all). If the
> > + * kernel does grant the thread extra time, it will set bit 0 to
> > + * inform user space that it has granted the thread more time and that
> > + * user space should call yield() as soon as it leaves its critical
>
> Does it specifically need to be yield(), or can it be just "entering
> the kernel" through any system call or trap ?
No it doesn't need to be yield. That just seemed like the obvious
system call to use. But any system call would force a schedule. We
could just optimize yield() though.
>
> [...]
>
> > diff --git a/kernel/rseq.c b/kernel/rseq.c
> > index 9de6e35fe679..b792e36a3550 100644
> > --- a/kernel/rseq.c
> > +++ b/kernel/rseq.c
> > @@ -339,6 +339,36 @@ void __rseq_handle_notify_resume(struct ksignal *ksig, struct pt_regs *regs)
> > force_sigsegv(sig);
> > }
> >
> > +bool rseq_delay_resched(void)
> > +{
> > + struct task_struct *t = current;
> > + u32 flags;
> > +
> > + if (!t->rseq)
> > + return false;
> > +
> > + /* Make sure the cr_counter exists */
> > + if (current->rseq_len <= offsetof(struct rseq, cr_counter))
> > + return false;
>
> It would be clearer/more precise with < offsetofend(struct rseq, cr_counter)
Ah yeah, thanks!
-- Steve
Powered by blists - more mailing lists