From: sashiko-bot@kernel.org
To: "Tejun Heo" <tj@kernel.org>
Cc: sched-ext@lists.linux.dev
Subject: Re: [PATCH 1/6] sched/core: Handle pick_task() releasing the rq lock
Date: Fri, 07 Aug 2026 21:26:47 +0000 [thread overview]
Message-ID: <20260807212648.A6D811F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260807210221.232543-2-tj@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Stale runqueue clock and WARN_DOUBLE_CLOCK splats upon pick_task() retry
--
--- Patch [1]: [PATCH 1/6] sched/core: Handle pick_task() releasing the rq lock ---
commit e3861f6642d2aed51cd1900fde0081c42124a072
Author: Tejun Heo <tj@kernel.org>
sched/core: Handle pick_task() releasing the rq lock
Core scheduling's pick_next_task() breaks when a ->pick_task() implementation
can release the rq lock. This patch handles this by restarting the whole
selection when a pick returns RETRY_TASK after releasing the lock.
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 96226707c2f61..136246846e792 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
[ ... ]
> @@ -6301,10 +6303,15 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
> * and there are no cookied tasks running on siblings.
> */
> if (!need_sync) {
> next = pick_task(rq, rf);
> - if (unlikely(next == RETRY_TASK))
> - goto restart_single;
> + if (unlikely(next == RETRY_TASK)) {
> + /* rq lock may have been dropped, clocks invalidated */
> + core_clock_updated = false;
> + if (!(rq->clock_update_flags & RQCF_UPDATED))
> + update_rq_clock(rq);
[Severity: High]
Does this bypass the clock update entirely? When pick_task() drops the lock
and repins it, the rq->clock_update_flags are preserved and restored. This
means RQCF_UPDATED would still be set, making this condition false and leaving
the runqueue clock stale despite the lock having been dropped.
> + goto restart;
> + }
> +
> if (!next->core_cookie) {
> rq->core_pick = NULL;
> rq->core_dl_server = NULL;
> @@ -6324,7 +6331,6 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
> *
> * Tie-break prio towards the current CPU
> */
> max = NULL;
> for_each_cpu_wrap(i, smt_mask, cpu) {
> rq_i = cpu_rq(i);
> @@ -6338,8 +6344,13 @@ pick_next_task(struct rq *rq, struct rq_flags *rf)
> update_rq_clock(rq_i);
[Severity: High]
Will this trigger a WARN_DOUBLE_CLOCK splat for sibling runqueues if the
loop is restarted?
If a previous pass updated the clock for rq_i, the RQCF_UPDATED flag is set.
When we hit goto restart, we loop again and call update_rq_clock(rq_i)
unconditionally without clearing the flag first.
>
> p = pick_task(rq_i, rf);
> - if (unlikely(p == RETRY_TASK))
> - goto restart_multi;
> + if (unlikely(p == RETRY_TASK)) {
> + /* rq lock may have been dropped, clocks invalidated */
> + core_clock_updated = false;
> + if (!(rq->clock_update_flags & RQCF_UPDATED))
> + update_rq_clock(rq);
[Severity: High]
Similarly, does this bypass the clock update on the local runqueue because
RQCF_UPDATED is still set after restoring the pin context?
> + goto restart;
> + }
>
> rq_i->core_pick = p;
> rq_i->core_dl_server = rq_i->dl_server;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260807210221.232543-1-tj@kernel.org?part=1
next prev parent reply other threads:[~2026-08-07 21:26 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 21:02 [PATCHSET sched_ext/for-7.2-fixes] sched_ext: Fix core scheduling Tejun Heo
2026-08-07 21:02 ` [PATCH 1/6] sched/core: Handle pick_task() releasing the rq lock Tejun Heo
2026-08-07 21:26 ` sashiko-bot [this message]
2026-08-10 11:00 ` Peter Zijlstra
2026-08-19 9:37 ` Peter Zijlstra
2026-08-19 12:24 ` Peter Zijlstra
2026-08-19 18:30 ` Tejun Heo
2026-08-07 21:02 ` [PATCH 2/6] sched/core: Make core-sched flips wait for in-flight selections Tejun Heo
2026-08-10 11:15 ` Peter Zijlstra
2026-08-10 22:10 ` Tejun Heo
2026-08-11 16:05 ` Peter Zijlstra
2026-08-07 21:02 ` [PATCH 3/6] sched_ext: Replace SCX_RQ_BAL_KEEP with a dispatch verdict return Tejun Heo
2026-08-11 7:43 ` Andrea Righi
2026-08-12 17:06 ` [PATCH v2 " Tejun Heo
2026-08-07 21:02 ` [PATCH 4/6] sched_ext: Fix this_rq() assumptions in dispatch kfuncs Tejun Heo
2026-08-07 21:02 ` [PATCH 5/6] sched_ext: Count rq lock releases in rq->scx.lock_drop_seq Tejun Heo
2026-08-07 21:02 ` [PATCH 6/6] sched_ext: Fix rq->core_pick corruption under core scheduling Tejun Heo
2026-08-07 21:22 ` sashiko-bot
2026-08-12 17:07 ` [PATCHSET sched_ext/for-7.2-fixes] sched_ext: Fix " Tejun Heo
2026-08-12 20:25 ` 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=20260807212648.A6D811F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sched-ext@lists.linux.dev \
--cc=tj@kernel.org \
/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