Re: [PATCH kernfs 1/3] kernfs: switch global kernfs_idr_lock to per-fs lock

From: Jinliang Zheng
Date: Tue Apr 15 2025 - 02:28:41 EST


On Mon, 14 Apr 2025 07:09:28 -1000, tj@xxxxxxxxxx wrote:
> On Sat, Apr 12, 2025 at 02:31:07AM +0800, alexjlzheng@xxxxxxxxx wrote:
> > From: Jinliang Zheng <alexjlzheng@xxxxxxxxxxx>
> >
> > The kernfs implementation has big lock granularity(kernfs_idr_lock) so
> > every kernfs-based(e.g., sysfs, cgroup) fs are able to compete the lock.
> >
> > This patch switches the global kernfs_idr_lock to per-fs lock, which
> > put the spinlock into kernfs_root.
> >
> > Signed-off-by: Jinliang Zheng <alexjlzheng@xxxxxxxxxxx>
>
> Given that it doesn't really make things any more complicated, I think this
> makes more sense than the existing code even without any direct evidence
> that this improves performance.

I agree.

thanks,
Jinliang Zheng :)

>
> Acked-by: Tejun Heo <tj@xxxxxxxxxx>
>
> Thanks.
>
> --
> tejun