>From df96928bc8d482d8b26c277c4ca0b075783c7aed Mon Sep 17 00:00:00 2001 From: Chris Down Date: Tue, 31 Mar 2020 19:16:23 +0100 Subject: [PATCH] temp --- mm/memcontrol.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index eecf003b0c56..c33e317c3667 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -2328,11 +2328,14 @@ static unsigned long calculate_high_delay(struct mem_cgroup *memcg, { unsigned long penalty_jiffies; u64 max_overage = 0; + int i = 0, i_overage = 0; do { unsigned long usage, high; u64 overage; + i++; + usage = page_counter_read(&memcg->memory); high = READ_ONCE(memcg->high); @@ -2342,18 +2345,29 @@ static unsigned long calculate_high_delay(struct mem_cgroup *memcg, */ high = max(high, 1UL); + trace_printk("usage: %lu, high: %lu\n", usage, high); overage = usage - high; + trace_printk("%d overage before shifting (%llu)\n", i, overage); overage <<= MEMCG_DELAY_PRECISION_SHIFT; + trace_printk("%d overage after shifting (%llu)\n", i, overage); overage = div64_u64(overage, high); + trace_printk("%d overage after div (%llu)\n", i, overage); - if (overage > max_overage) + if (overage > max_overage) { + trace_printk("%d cgroup new overage (%llu)\n", i, overage); + i_overage = i; max_overage = overage; + } else { + trace_printk("%d cgroup too low (%llu)\n", i, overage); + } } while ((memcg = parent_mem_cgroup(memcg)) && !mem_cgroup_is_root(memcg)); if (!max_overage) return 0; + trace_printk("Used %d from leaf to get result\n", i_overage); + /* * We use overage compared to memory.high to calculate the number of * jiffies to sleep (penalty_jiffies). Ideally this value should be -- 2.26.0