Re: [PATCH] kernfs: Use RCU for kernfs_node::name lookup.
From: Sebastian Andrzej Siewior
Date: Wed Nov 13 2024 - 02:58:51 EST
On 2024-11-12 09:02:53 [-1000], Tejun Heo wrote:
> Hello, Sebastian.
Hi Tejun,
> Sorry about late reply. Have been sick for a bit.
No worries, hopefully you are getting better.
> On Mon, Nov 11, 2024 at 06:04:50PM +0100, Sebastian Andrzej Siewior wrote:
> ...
> > Let me check if I understood. We have three users of kernfs:
> >
> > - cgroup
> > cgroup1_rename(): parent check (would get the new KERNFS_ROOT flag)
> >
> > - resctrl
> > rdtgroup_rename(): seems to allow any "mon group" directory
> > different parent possible.
> >
> > - sysfs
> > sysfs_move_dir_ns(): reame to a different parent
>
> I'm not sure about resctrl but here we just need to add that flag to cgroup,
> right?
Correct. I was just puzzling your answer together ;)
> > That new RCU interface would be used by cgroup only and sysfs/ resctrl
> > would remain using the "old" code?
> > If so, would you prefer
> > |struct kernfs_node {
> > | …
> > | union {
> > | const char name;
> > | const char __rcu *name_rcu;
> > | }
> >
> > to avoid patching resctrl + sysfs for for the rcu_derference name
> > lookup?
>
> As replied on the patches, it probably is cleaner to always use __rcu and
> apply the additional locking on the reader side if renaming across different
> parents is allowed.
Yes, on it.
> Thanks.
Sebastian