From: Tejun Heo <tj@kernel.org>
To: David Vernet <void@manifault.com>
Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com,
Andrea Righi <andrea.righi@linux.dev>
Subject: Re: [PATCH sched_ext/for-6.12] sched_ext: TASK_DEAD tasks must be switched out of SCX on ops_disable
Date: Wed, 4 Sep 2024 10:23:11 -1000 [thread overview]
Message-ID: <ZtjBrxdWJzMBjTxW@slm.duckdns.org> (raw)
In-Reply-To: <ZtJZaKxg39SkQtMA@slm.duckdns.org>
On Fri, Aug 30, 2024 at 01:44:40PM -1000, Tejun Heo wrote:
> scx_ops_disable_workfn() only switches !TASK_DEAD tasks out of SCX while
> calling scx_ops_exit_task() on all tasks including dead ones. This can leave
> a dead task on SCX but with SCX_TASK_NONE state, which is inconsistent.
>
> If another task was in the process of changing the TASK_DEAD task's
> scheduling class and grabs the rq lock after scx_ops_disable_workfn() is
> done with the task, the task ends up calling scx_ops_disable_task() on the
> dead task which is in an inconsistent state triggering a warning:
>
> WARNING: CPU: 6 PID: 3316 at kernel/sched/ext.c:3411 scx_ops_disable_task+0x12c/0x160
> ...
> RIP: 0010:scx_ops_disable_task+0x12c/0x160
> ...
> Call Trace:
> <TASK>
> check_class_changed+0x2c/0x70
> __sched_setscheduler+0x8a0/0xa50
> do_sched_setscheduler+0x104/0x1c0
> __x64_sys_sched_setscheduler+0x18/0x30
> do_syscall_64+0x7b/0x140
> entry_SYSCALL_64_after_hwframe+0x76/0x7e
> RIP: 0033:0x7f140d70ea5b
>
> There is no reason to leave dead tasks on SCX when unloading the BPF
> scheduler. Fix by making scx_ops_disable_workfn() eject all tasks including
> the dead ones from SCX.
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
Applied to sched_ext/for-6.12.
Thanks.
--
tejun
prev parent reply other threads:[~2024-09-04 20:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-30 23:44 Tejun Heo
2024-09-04 20:23 ` Tejun Heo [this message]
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=ZtjBrxdWJzMBjTxW@slm.duckdns.org \
--to=tj@kernel.org \
--cc=andrea.righi@linux.dev \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=void@manifault.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®