From: Cheng-Yang Chou <yphbchou0911@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: David Vernet <void@manifault.com>,
Andrea Righi <arighi@nvidia.com>,
Changwoo Min <changwoo@igalia.com>,
sched-ext@lists.linux.dev,
Emil Tsalapatis <emil@etsalapatis.com>,
linux-kernel@vger.kernel.org,
Ching-Chun Huang <jserv@ccns.ncku.edu.tw>,
Chia-Ping Tsai <chia7712@gmail.com>
Subject: Re: [PATCH sched_ext/for-7.2] sched_ext: add p->scx.tid and SCX_OPS_TID_TO_TASK lookup
Date: Mon, 20 Apr 2026 02:10:58 +0800 [thread overview]
Message-ID: <20260420015438.G7a71@cchengyang.duckdns.org> (raw)
In-Reply-To: <a19c8c74d7c767bc9865b75d6de7c723@kernel.org>
Hi Tejun, sorry for the noise
On Sun, Apr 19, 2026 at 06:18:46AM -1000, Tejun Heo wrote:
[snipped]
> void scx_pre_fork(struct task_struct *p)
> {
> /*
> @@ -3682,6 +3732,8 @@ int scx_fork(struct task_struct *p, stru
>
> percpu_rwsem_assert_held(&scx_fork_rwsem);
>
> + p->scx.tid = scx_alloc_tid();
> +
> if (scx_init_task_enabled) {
> #ifdef CONFIG_EXT_SUB_SCHED
> struct scx_sched *sch = kargs->cset->dfl_cgrp->scx_sched;
> @@ -3717,9 +3769,13 @@ void scx_post_fork(struct task_struct *p
> }
> }
>
> - raw_spin_lock_irq(&scx_tasks_lock);
> - list_add_tail(&p->scx.tasks_node, &scx_tasks);
> - raw_spin_unlock_irq(&scx_tasks_lock);
> + scoped_guard(raw_spinlock_irq, &scx_tasks_lock) {
> + list_add_tail(&p->scx.tasks_node, &scx_tasks);
> + if (scx_tid_to_task_enabled())
> + rhashtable_lookup_insert_fast(&scx_tid_hash,
After reading the review from Sashiko [1], should we handle insertion
failures here?
ret = rhashtable_lookup_insert_fast()
if(unlikely(ret))
scx_error(...)
> + &p->scx.tid_hash_node,
> + scx_tid_hash_params);
> + }
>
> percpu_up_read(&scx_fork_rwsem);
> }
[...]
> + /*
> + * Insert into the tid hash under scx_tasks_lock so we can't
> + * race sched_ext_dead() and leave a stale entry for an already
> + * exited task.
> + */
> + if (scx_tid_to_task_enabled()) {
> + guard(raw_spinlock_irq)(&scx_tasks_lock);
> + if (!list_empty(&p->scx.tasks_node))
> + rhashtable_lookup_insert_fast(&scx_tid_hash,
Same here, thanks.
> + &p->scx.tid_hash_node,
> + scx_tid_hash_params);
> + }
> +
> put_task_struct(p);
> }
[1]: https://sashiko.dev/#/patchset/a19c8c74d7c767bc9865b75d6de7c723%40kernel.org
--
Cheers,
Cheng-Yang
prev parent reply other threads:[~2026-04-19 18:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-19 16:18 [PATCH sched_ext/for-7.2] sched_ext: add p->scx.tid and SCX_OPS_TID_TO_TASK lookup Tejun Heo
2026-04-19 17:02 ` Andrea Righi
2026-04-19 18:12 ` Tejun Heo
2026-04-19 18:31 ` Andrea Righi
2026-04-19 17:23 ` Cheng-Yang Chou
2026-04-19 18:10 ` Cheng-Yang Chou [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=20260420015438.G7a71@cchengyang.duckdns.org \
--to=yphbchou0911@gmail.com \
--cc=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=chia7712@gmail.com \
--cc=emil@etsalapatis.com \
--cc=jserv@ccns.ncku.edu.tw \
--cc=linux-kernel@vger.kernel.org \
--cc=sched-ext@lists.linux.dev \
--cc=tj@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