On Fri, Nov 29, 2024 at 12:32:36PM +0100, Jeremi Piotrowski wrote: > From: Minchan Kim <minchan@xxxxxxxxxx> > > [ Upstream commit 393c3714081a53795bbff0e985d24146def6f57f ] > > The kernfs implementation has big lock granularity(kernfs_rwsem) so > every kernfs-based(e.g., sysfs, cgroup) fs are able to compete the > lock. It makes trouble for some cases to wait the global lock > for a long time even though they are totally independent contexts > each other. > > A general example is process A goes under direct reclaim with holding > the lock when it accessed the file in sysfs and process B is waiting > the lock with exclusive mode and then process C is waiting the lock > until process B could finish the job after it gets the lock from > process A. > > This patch switches the global kernfs_rwsem to per-fs lock, which > put the rwsem into kernfs_root. > > Suggested-by: Tejun Heo <tj@xxxxxxxxxx> > Acked-by: Tejun Heo <tj@xxxxxxxxxx> > Signed-off-by: Minchan Kim <minchan@xxxxxxxxxx> > Link: https://lore.kernel.org/r/20211118230008.2679780-1-minchan@xxxxxxxxxx > Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> > Signed-off-by: Jeremi Piotrowski <jpiotrowski@xxxxxxxxxxxxxxxxxxx> > --- > Hi Stable Maintainers, > > This upstream commit fixes a kernel hang due to severe lock contention on > kernfs_rwsem that occurs when container workloads perform a lot of cgroupfs > accesses. Could you please apply to 5.15.y? I cherry-pick the upstream commit > to v5.15.173 and then performed `git format-patch`. This should not hang, but rather just reduce contention, right? Do you have real performance numbers that show this is needed? What workloads are overloading cgroupfs? And why not just switch them to 6.1.y kernels or newer? thanks, greg k-h