public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Michal Koutný" <mkoutny@suse.com>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Hillf Danton" <hdanton@sina.com>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Marco Elver" <elver@google.com>,
	tglx@linutronix.de,
	syzbot+6ea37e2e6ffccf41a7e6@syzkaller.appspotmail.com
Subject: Re: [PATCH v2 2/2] cgroup, kernfs: Move cgroup to the RCU interface for name lookups
Date: Wed, 13 Nov 2024 08:28:02 -1000	[thread overview]
Message-ID: <ZzTvsueQ_THOT6EW@slm.duckdns.org> (raw)
In-Reply-To: <20241113132333.ayhH2ZH-@linutronix.de>

Hello,

On Wed, Nov 13, 2024 at 02:23:33PM +0100, Sebastian Andrzej Siewior wrote:
...
> > That is the easy part. kernfs_path_from_node() is different as it
> > requires the parent pointer. In order to distinguish the RCU from the
> > non-RCU version I need kernfs_root for the flag and depending on it, the
> > lock so the parent does not go away.
> > 
> > Would it work to add the pointer to kernfs_root into kernfs_node? This
> > would shrink kernfs_elem_dir by a pointer but the union would remain the
> > same size due to kernfs_elem_attr so the struct would grow.
> 
> The kernfs_node is released via RCU. That means if the RCU read section
> starts before kernfs_root() then we should always get a stable pointer,
> pointing to the same kernfs_root node since it is always the same one.
> Even if the `parent' pointer is replaced. Wouldn't we need __rcu
> annotation then for the `parent' pointer then?

Yeah, I think this is the better direction. Just make both the parent and
name RCU protected, drop the rename rwlock and use RCU deref for both
->parent and ->name so that the code path doesn't have to diverge.

Thanks.

-- 
tejun

      reply	other threads:[~2024-11-13 18:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-12 15:52 [PATCH v2 0/2] Let cgroup use RCU for kernfs_node::name lookup Sebastian Andrzej Siewior
2024-11-12 15:52 ` [PATCH v2 1/2] kernfs: Make it possible to " Sebastian Andrzej Siewior
2024-11-12 18:52   ` Tejun Heo
2024-11-13  7:42     ` Sebastian Andrzej Siewior
2024-11-14 13:48   ` Michal Koutný
2024-11-15 17:32     ` Sebastian Andrzej Siewior
2024-11-12 15:52 ` [PATCH v2 2/2] cgroup, kernfs: Move cgroup to the RCU interface for name lookups Sebastian Andrzej Siewior
2024-11-12 18:59   ` Tejun Heo
2024-11-13  7:43     ` Sebastian Andrzej Siewior
2024-11-13 12:07       ` Sebastian Andrzej Siewior
2024-11-13 13:23         ` Sebastian Andrzej Siewior
2024-11-13 18:28           ` 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=ZzTvsueQ_THOT6EW@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=boqun.feng@gmail.com \
    --cc=cgroups@vger.kernel.org \
    --cc=elver@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkoutny@suse.com \
    --cc=paulmck@kernel.org \
    --cc=syzbot+6ea37e2e6ffccf41a7e6@syzkaller.appspotmail.com \
    --cc=tglx@linutronix.de \
    /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