[Devel] [PATCH RH7] memcontrol: debug for hang in mem_cgroup_reparent_charges
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Fri Mar 18 15:44:49 MSK 2022
This adds a soft_timeout of 1 min, if we hit it then debug message would
be printed to show for how many minutes we are hanging, and soft_timeout
is reset to be triggered in 1 min again, until we reach hard timeout.
This should probably be posible as RK patch.
https://jira.sw.ru/browse/PSBM-139206
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
mm/memcontrol.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index aa933c25733f..cb5bdc05f2ca 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4596,6 +4596,8 @@ static void mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
/* Protection from leaked memcg->memory counter. */
unsigned long start_time = jiffies;
unsigned long timeout = start_time + HZ*1200;
+ unsigned long soft_timeout = start_time + HZ*60;
+ unsigned long num_soft_timeout = 0;
unsigned long mem, kmem;
do {
@@ -4637,6 +4639,16 @@ static void mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
*/
smp_rmb();
kmem = page_counter_read(&memcg->kmem);
+
+ if (time_after(jiffies, soft_timeout)) {
+ while (time_after(jiffies, soft_timeout)) {
+ soft_timeout += HZ*60;
+ num_soft_timeout++;
+ }
+
+ printk("mem_cgroup_reparent_charges: hang for %lu minutes\n",
+ num_soft_timeout++);
+ }
} while ((mem - kmem > 0) && time_before(jiffies, timeout));
WARN_ONCE((mem - kmem > 0),
--
2.35.1
More information about the Devel
mailing list