ack
--
Best regards,
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
On 04.08.2025 06:39, Pavel Tikhomirov wrote:
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 59eb819c91052..4512a16d9ede3 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3221,18 +3221,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