Re: [PATCH kernfs 3/3] kernfs: switch global kernfs_pr_cont_lock to per-fs lock
From: Tejun Heo
Date: Mon Apr 14 2025 - 13:27:38 EST
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.
Thanks.
--
tejun