From: Tejun Heo <tj@kernel.org>
To: Andrea Righi <arighi@nvidia.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
John Stultz <jstultz@google.com>,
sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: proxy_reset_donor() warning from sched_proxy_block_task() when p is curr
Date: Mon, 02 Nov 2026 07:55:09 -1000 [thread overview]
Message-ID: <98e1914a51b7851253e93b2c6d756261@kernel.org> (raw)
Hello,
sched_proxy_block_task() calls proxy_reset_donor() whenever p is the
donor, without checking that p isn't also curr. proxy_reset_donor() then
triggers its WARN_ON_ONCE(rq->donor == rq->curr):
WARNING: kernel/sched/core.c:3809 at proxy_reset_donor+0x129/0x140, CPU#3: flip/1539
Call Trace:
sched_proxy_block_task+0xa1/0x170
scx_prepare_setscheduler+0xcf/0xe0
__sched_setscheduler+0x6d6/0xb60
do_sched_setscheduler+0x105/0x160
__x64_sys_sched_setscheduler+0x18/0x30
do_syscall_64+0xec/0x420
entry_SYSCALL_64_after_hwframe+0x76/0x7e
p is a sched_ext task under a scheduler with SCX_OPS_ENQ_BLOCKED. It
blocks on a mutex in __schedule() and stays queued as a retained donor,
still curr and donor until the pick finishes. The pick goes through
sched_ext dispatch, which drops the rq lock while ops.dispatch() moves a
task from another CPU.
In that window, sched_setscheduler(p, SCHED_EXT) from another CPU takes
p's pi_lock and rq lock and reaches sched_proxy_block_task() with p both
curr and donor. I also hit it, rarely, through scx_sub_enable_workfn()
-> scx_prepare_task_sched_change().
Nothing else went wrong in my runs. The pick sees p dequeued and carries
on.
It reproduces reliably within a minute in an 8-CPU VM on
sched_ext/for-7.4-fixes (2227a34ff7bf) with:
scx_qmap -X -s 100
stress-ng --cpu 4 --cpu-method loop
modprobe locktorture torture_type=mutex_lock nested_locks=8 \
long_hold=2 nwriters_stress=16
and a small program that flips the lock_torture_wr threads between
SCHED_EXT and SCHED_OTHER with sched_setscheduler() as fast as it can.
Thanks.
--
tejun
reply other threads:[~2026-11-02 17:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=98e1914a51b7851253e93b2c6d756261@kernel.org \
--to=tj@kernel.org \
--cc=arighi@nvidia.com \
--cc=jstultz@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=sched-ext@lists.linux.dev \
/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®