Re: [PATCH v2 2/2] cgroup, kernfs: Move cgroup to the RCU interface for name lookups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux