Re: [PATCH] kernfs: Use RCU for kernfs_node::name lookup.
From: Tejun Heo
Date: Tue Nov 12 2024 - 17:42:12 EST
Hello, Sebastian.
Sorry about late reply. Have been sick for a bit.
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?
> 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.
Thanks.
--
tejun