From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Prakash Sangappa <prakash.sangappa@oracle.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
rostedt@goodmis.org, mathieu.desnoyers@efficios.com,
tglx@linutronix.de
Subject: Re: [PATCH V2 1/3] Sched: Scheduler time slice extension
Date: Thu, 24 Apr 2025 16:13:45 +0200 [thread overview]
Message-ID: <20250424141345.7F42GFmZ@linutronix.de> (raw)
In-Reply-To: <20250418193410.2010058-2-prakash.sangappa@oracle.com>
On 2025-04-18 19:34:08 [+0000], Prakash Sangappa wrote:
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
…
> @@ -930,6 +931,9 @@ struct task_struct {
> struct plist_node pushable_tasks;
> struct rb_node pushable_dl_tasks;
> #endif
> +#ifdef CONFIG_RSEQ
> + unsigned rseq_sched_delay:1;
> +#endif
There should be somewhere a bitfield already which you could use without
the ifdef. Then you could use IS_ENABLED() if you want to save some code
if RSEQ is not enabled.
>
> struct mm_struct *mm;
> struct mm_struct *active_mm;
> --- a/include/uapi/linux/rseq.h
> +++ b/include/uapi/linux/rseq.h
…
> @@ -128,6 +131,8 @@ struct rseq {
> * - RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE
> * Inhibit instruction sequence block restart on migration for
> * this thread.
> + * - RSEQ_CS_DELAY_RESCHED
> + * Try delay resched...
Delay resched up to $time for $kind-of-stats under $conditions.
> */
> __u32 flags;
>
> diff --git a/kernel/entry/common.c b/kernel/entry/common.c
> index 6b7ff1bc1b9b..944027d14198 100644
> --- a/kernel/entry/common.c
> +++ b/kernel/entry/common.c
…
> @@ -99,8 +100,12 @@ __always_inline unsigned long exit_to_user_mode_loop(struct pt_regs *regs,
>
> local_irq_enable_exit_to_user(ti_work);
>
> - if (ti_work & (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY))
> - schedule();
> + if (ti_work & (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY)) {
couldn't we restrict this to _TIF_NEED_RESCHED_LAZY? That way we would
still schedule immediately for any SCHED_FIFO/RR/DL tasks and do this
delay only for everything else such as SCHED_OTHER/…
> + if (irq && rseq_delay_resched())
> + clear_tsk_need_resched(current);
> + else
> + schedule();
> + }
>
> if (ti_work & _TIF_UPROBE)
> uprobe_notify_resume(regs);
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 165c90ba64ea..cee50e139723 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -823,6 +823,7 @@ void update_rq_clock(struct rq *rq)
>
> static void hrtick_clear(struct rq *rq)
> {
> + rseq_delay_resched_tick();
This is called from __schedule(). If you set the need-resched flag here,
it gets removed shortly after. Do I miss something?
> if (hrtimer_active(&rq->hrtick_timer))
> hrtimer_cancel(&rq->hrtick_timer);
> }
Sebastian
next prev parent reply other threads:[~2025-04-24 14:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-18 19:34 [PATCH V2 0/3] Scheduler time slice extension Prakash Sangappa
2025-04-18 19:34 ` [PATCH V2 1/3] Sched: " Prakash Sangappa
2025-04-24 14:13 ` Sebastian Andrzej Siewior [this message]
2025-04-25 1:19 ` Prakash Sangappa
2025-04-25 3:48 ` K Prateek Nayak
2025-04-25 17:07 ` Prakash Sangappa
2025-04-25 6:53 ` Sebastian Andrzej Siewior
2025-04-25 18:55 ` Prakash Sangappa
2025-04-18 19:34 ` [PATCH V2 2/3] Sched: Tunable to specify duration of " Prakash Sangappa
2025-04-18 19:34 ` [PATCH V2 3/3] Sched: Add scheduler stat for cpu " Prakash Sangappa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250424141345.7F42GFmZ@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=peterz@infradead.org \
--cc=prakash.sangappa@oracle.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox