The commit is pushed to "branch-rh10-6.12.0-55.13.1.vz10.2.x-ovz" and will appear at g...@bitbucket.org:openvz/vzkernel.git after rh10-6.12.0-55.13.1.el10 ------> commit 333f254f205b2bd67140f3923806347af62f66cb Author: Pavel Tikhomirov <ptikhomi...@virtuozzo.com> Date: Mon Aug 4 11:29:48 2025 +0800
mm: fix negative dentry accounting by protecting memcg with rcu_read_lock This fixes the warning: WARNING: CPU: 0 PID: 1 at include/linux/memcontrol.h:404 mem_cgroup_from_slab_obj+0x426/0x580 In this stack: +-> dput +-> __dentry_kill +-> d_lru_del +-> memcg_neg_dentry_dec +-> mem_cgroup_from_slab_obj +-> mem_cgroup_from_obj_folio +-> obj_cgroup_memcg Detected when running xfstests-generic/321. https://virtuozzo.atlassian.net/browse/VSTOR-112802 Fixes: 2b4edb1f998a ("mm: per-memcg negative dentries accounting") Signed-off-by: Pavel Tikhomirov <ptikhomi...@virtuozzo.com> Feature: mm: statistic enhancements --- mm/memcontrol.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 175d43481c6f2..3563586ff93fd 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3240,18 +3240,24 @@ unsigned long mem_cgroup_read_nd(struct mem_cgroup *memcg) void memcg_neg_dentry_inc(struct dentry *dentry) { - struct mem_cgroup *memcg = mem_cgroup_from_slab_obj(dentry); + struct mem_cgroup *memcg; + rcu_read_lock(); + memcg = mem_cgroup_from_slab_obj(dentry); if (memcg) __this_cpu_inc(memcg->vmstats_percpu->nr_dentry_neg); + rcu_read_unlock(); } void memcg_neg_dentry_dec(struct dentry *dentry) { - struct mem_cgroup *memcg = mem_cgroup_from_slab_obj(dentry); + struct mem_cgroup *memcg; + rcu_read_lock(); + memcg = mem_cgroup_from_slab_obj(dentry); if (memcg) __this_cpu_dec(memcg->vmstats_percpu->nr_dentry_neg); + rcu_read_unlock(); } /* _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel