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

From: Jinliang Zheng
Date: Tue Apr 15 2025 - 02:37:34 EST


On Mon, 14 Apr 2025 07:27:21 -1000, tj@xxxxxxxxxx wrote:
> On Sat, Apr 12, 2025 at 02:31:09AM +0800, alexjlzheng@xxxxxxxxx wrote:
> > From: Jinliang Zheng <alexjlzheng@xxxxxxxxxxx>
> >
> > The kernfs implementation has big lock granularity(kernfs_pr_cont_lock) so
> > every kernfs-based(e.g., sysfs, cgroup) fs are able to compete the lock.
> >
> > This patch switches the global kernfs_pr_cont_lock to per-fs lock, which
> > put the spinlock into kernfs_root. Of course, kernfs_pr_cont_buf also needs
> > to be moved to kernfs_root.
> >
> > Signed-off-by: Jinliang Zheng <alexjlzheng@xxxxxxxxxxx>
>
> I don't think this one makes sense. There are lots more things that are
> globally synchronizing in the printk pass. This is necessarily a really cold
> path and it doesn't make anything better to split this lock.

Thank you for your reply, :)

>From a performance perspective, I agree. From a design perspective, I can
only agree 50%, hahahaha.

But compared to the other two global locks in this patchset, the changes to
this lock are relatively unimportant.

thanks,
Jinliang Zheng :)

>
> Thanks.
>
> --
> tejun