On Tue, Jan 28, 2025 at 09:42:26AM +0100, Sebastian Andrzej Siewior wrote: > Using RCU lifetime rules to access kernfs_node::name can avoid the > trouble kernfs_rename_lock in kernfs_name() and kernfs_path_from_node() > if the fs was created with KERNFS_ROOT_INVARIANT_PARENT. This is useful > as it allows to implement kernfs_path_from_node() only with RCU > protection and avoiding kernfs_rename_lock. The lock is only required if > the __parent node can be changed and the function requires an unchanged > hierarchy while it iterates from the node to its parent. A short mention of how avoiding kernfs_rename_lock matters would be great - ie. where did this show up? > diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h > index 955999aecfca9..cc83dbc70a8ef 100644 > --- a/arch/x86/kernel/cpu/resctrl/internal.h > +++ b/arch/x86/kernel/cpu/resctrl/internal.h > @@ -505,6 +505,11 @@ int parse_bw(struct rdt_parse_data *data, struct resctrl_schema *s, > > extern struct mutex rdtgroup_mutex; > > +static inline const char *rdt_kn_get_name(const struct kernfs_node *kn) > +{ > + return rcu_dereference_check(kn->name, lockdep_is_held(&rdtgroup_mutex)); > +} Maybe rdt_kn_name()? Other than those, Acked-by: Tejun Heo <tj@xxxxxxxxxx> Thanks. -- tejun