From: Tejun Heo <tj@kernel.org>
To: Andrea Righi <arighi@nvidia.com>
Cc: Tejun Heo <tj@kernel.org>, David Vernet <void@manifault.com>,
Changwoo Min <changwoo@igalia.com>,
Emil Tsalapatis <etsal@meta.com>,
Cheng-Yang Chou <yphbchou0911@gmail.com>,
sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] sched_ext: Add lazy preemption support
Date: Wed, 16 Sep 2026 11:03:36 -1000 [thread overview]
Message-ID: <bce097463a431a8fde2359539e4e5303@kernel.org> (raw)
In-Reply-To: <20260915194611.2674127-2-arighi@nvidia.com>
Hello, Andrea.
This is an AI review. The series was built and the selftests pass under vng
here, and the kick and tick paths were traced and look correct. A few things
to fix up.
On Tue, Sep 15, 2026 at 09:45:12PM +0200, Andrea Righi wrote:
> + * modified afterwards with scx_bpf_task_set_slice_expiry().
> + */
> + bool slice_expires_lazy;
This adds 8 bytes to task_struct for a bool. Put it next to @disallow, there
are three bytes of padding after it.
> + * A task in user space still reschedules on the way back from the tick; a
> + * task in the kernel runs on to its next return to user space or to the
> + * next tick, which promotes the request. No effect on kernels without
> + * lazy preemption. Rescheduling while disabling stays immediate.
Lazy is a runtime mode under PREEMPT_DYNAMIC, so "kernels without lazy
preemption" isn't right. And what forces immediate rescheduling is bypassing,
not disabling.
> +static void scx_resched_curr_lazy(struct rq *rq)
> +{
> + if (rq->scx.flags & SCX_RQ_CAN_STOP_TICK) {
> + rq->scx.flags &= ~SCX_RQ_CAN_STOP_TICK;
> + if (rq->clock_update_flags < RQCF_UPDATED)
> + update_rq_clock(rq);
> + update_other_load_avgs(rq);
> + sched_update_tick_dependency(rq);
> + }
> +
> + resched_curr_lazy(rq);
> +}
Setting the TIF bit before restoring the tick dependency would let the tick
IPI's return to user space serve the reschedule instead of waiting for the
next tick. Not critical.
> -/* common to both forms: only scx.disallow is writable */
> +/* common to both forms: only the fields below are writable */
Nothing else became writable. Drop the hunk.
> - raw_spin_rq_lock_irqsave(rq, flags);
> + rq_lock_irqsave(rq, &rf);
Please explain this in the description. Pinning clears RQCF_UPDATED, which is
what makes the clock_update_flags test in scx_resched_curr_lazy() do anything
on this path.
> + if (unlikely(flags & ~(SCX_KICK_IDLE | SCX_KICK_PREEMPT | SCX_KICK_WAIT |
> + SCX_KICK_PREEMPT_LAZY))) {
> + scx_error(sch, "invalid kick flags 0x%llx", flags);
> + return;
> + }
Unknown flags were silently ignored before, so this is a behavior change and
the description should say so. The SCX_KICK_IDLE check already existed, it
just returns early now.
> + * - SCX_ENQ_PREEMPT and SCX_ENQ_PREEMPT_LAZY inserts
> + * - SCX_KICK_PREEMPT and SCX_KICK_PREEMPT_LAZY kicks
insert, kick.
> +/*
> + * v7.4: scx_bpf_task_set_slice_expiry() added to enforce sub-scheduler task
> + * ownership. Preserve until v7.7.
> + */
This is copied from the block above and doesn't apply. The kfunc is new with
the feature, there was no field write to replace.
> +#define HAVE_SCX_KICK_PREEMPT_LAZY
> #define HAVE_SCX_KICK_WAIT
The autogen headers follow definition order, so SCX_KICK_PREEMPT_LAZY goes
after SCX_KICK_WAIT in all four. Please regenerate them instead of editing.
Thanks.
--
tejun
next prev parent reply other threads:[~2026-09-16 21:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 19:45 [PATCHSET v5 sched_ext/for-7.4] " Andrea Righi
2026-09-15 19:45 ` [PATCH 1/2] " Andrea Righi
2026-09-16 21:03 ` Tejun Heo [this message]
2026-09-15 19:45 ` [PATCH 2/2] selftests/sched_ext: Add lazy preemption tests Andrea Righi
2026-09-16 21:03 ` Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2026-09-15 9:00 [PATCHSET v4 sched_ext/for-7.4] sched_ext: Add lazy preemption support Andrea Righi
2026-09-15 9:00 ` [PATCH 1/2] " Andrea Righi
2026-09-14 14:44 [PATCHSET v3 sched_ext/for-7.4] " Andrea Righi
2026-09-14 14:44 ` [PATCH 1/2] " Andrea Righi
2026-09-14 8:47 [PATCHSET v2 sched_ext/for-7.4] " Andrea Righi
2026-09-14 8:47 ` [PATCH 1/2] " Andrea Righi
2026-09-11 19:56 [PATCHSET sched_ext/for-7.4] " Andrea Righi
2026-09-11 19:56 ` [PATCH 1/2] " Andrea Righi
2026-09-13 16:50 ` Tejun Heo
2026-09-14 6:05 ` Andrea Righi
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=bce097463a431a8fde2359539e4e5303@kernel.org \
--to=tj@kernel.org \
--cc=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=etsal@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sched-ext@lists.linux.dev \
--cc=void@manifault.com \
--cc=yphbchou0911@gmail.com \
/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
all inboxes | Powered by JetHome®