[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e83ce086-b55f-431a-a499-f83a434b70db@efficios.com>
Date: Sat, 1 Feb 2025 15:35:13 +0100
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Steven Rostedt <rostedt@...dmis.org>, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org
Cc: 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 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 ?
[...]
> 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)
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
Powered by blists - more mailing lists