All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Righi <arighi@nvidia.com>
To: Tejun Heo <tj@kernel.org>
Cc: David Vernet <void@manifault.com>,
	Changwoo Min <changwoo@igalia.com>,
	sched-ext@lists.linux.dev, Emil Tsalapatis <emil@etsalapatis.com>,
	linux-kernel@vger.kernel.org,
	Cheng-Yang Chou <yphbchou0911@gmail.com>
Subject: Re: [PATCH sched_ext/for-7.2] sched_ext: add p->scx.tid and SCX_OPS_TID_TO_TASK lookup
Date: Sun, 19 Apr 2026 20:31:29 +0200	[thread overview]
Message-ID: <aeUfgbeUevwfvcXI@gpd4> (raw)
In-Reply-To: <070b4b9e6b56a0c9e2e61423f35837b4@kernel.org>

On Sun, Apr 19, 2026 at 08:12:02AM -1000, Tejun Heo wrote:
> Hello,
> 
> On Sun, Apr 19, 2026 at 07:02:47PM +0200, Andrea Righi wrote:
> > I'm wondering if we should have a teardown function, called before disabling
> > SCX_OPS_TID_TO_TASK and destroying scx_tid_hash, to explicitly remove all the
> > scx_tid_hash entries via rhashtable_remove_fast().
> 
> rhashtable_remove_fast() doesn't clear tid_hash_node.next either - it
> just unlinks from the bucket chain, leaving obj->next at whatever the
> chain successor or nulls-marker put there. So explicit drain wouldn't
> give us a cleaner post-state.
> 
> And the stale pointer is never read. After the static key is disabled,
> scx_post_fork/sched_ext_dead/scx_bpf_tid_to_task all gate on the key and
> skip the hash. On re-enable, rhashtable_init() creates fresh buckets and
> task iteration re-inserts each live task via
> rhashtable_lookup_insert_fast(), which unconditionally does
> 
>     RCU_INIT_POINTER(obj->next, head);
> 
> at include/linux/rhashtable.h:838. Lookups always traverse from
> ht->tbl[hash], never from an embedded node.

Ah, I missed the unconditional re-init, then we should be fine.
Thanks for clarifying it.

-Andrea

  reply	other threads:[~2026-04-19 18:31 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 [this message]
2026-04-19 17:23 ` Cheng-Yang Chou
2026-04-19 18:10 ` Cheng-Yang Chou

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=aeUfgbeUevwfvcXI@gpd4 \
    --to=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=emil@etsalapatis.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=tj@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.