Hello, On Tue, May 02, 2023 at 03:38:47PM +0200, Michal Koutný wrote: > /proc/$pid/mountinfo may accumulate lots of entries (causing frequent > re-reads of whole file) or lots cgroupfs entries alone. > The cgroupfs entries rendered with cgroup_show_path() may increase/be > subject of css_set_lock contention causing further slowdown -- not only > mountinfo rendering but any other css_set_lock user. > > We leverage the fact that mountinfo reading happens with namespace_sem > taken and hierarchy roots thus cannot be freed concurrently. > > There are three relevant nodes for each cgroupfs entry: > > R ... cgroup hierarchy root > M ... mount root > C ... reader's cgroup NS root > > mountinfo is supposed to show path from C to M. At least for cgroup2, the path from C to M isn't gonna change once NS is established, right? Nothing can be moved or renamed while the NS root is there. If so, can't we just cache the formatted path and return the same thing without any locking? The proposed changes seem a bit too brittle to me. Thanks. -- tejun