The patch titled Subject: mm/memcg: move penalty delay clamping out of calculate_high_delay() has been added to the -mm tree. Its filename is mm-move-penalty-delay-clamping-out-of-calculate_high_delay.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-move-penalty-delay-clamping-out-of-calculate_high_delay.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-move-penalty-delay-clamping-out-of-calculate_high_delay.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Jakub Kicinski <kuba@xxxxxxxxxx> Subject: mm/memcg: move penalty delay clamping out of calculate_high_delay() We will want to call calculate_high_delay() twice - once for memory and once for swap, and we should apply the clamp value to sum of the penalties. Clamping has to be applied outside of calculate_high_delay(). Link: http://lkml.kernel.org/r/20200527195846.102707-3-kuba@xxxxxxxxxx Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> Reviewed-by: Shakeel Butt <shakeelb@xxxxxxxxxx> Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Chris Down <chris@xxxxxxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memcontrol.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- a/mm/memcontrol.c~mm-move-penalty-delay-clamping-out-of-calculate_high_delay +++ a/mm/memcontrol.c @@ -2386,14 +2386,7 @@ static unsigned long calculate_high_dela * MEMCG_CHARGE_BATCH pages is nominal, so work out how much smaller or * larger the current charge patch is than that. */ - penalty_jiffies = penalty_jiffies * nr_pages / MEMCG_CHARGE_BATCH; - - /* - * Clamp the max delay per usermode return so as to still keep the - * application moving forwards and also permit diagnostics, albeit - * extremely slowly. - */ - return min(penalty_jiffies, MEMCG_MAX_HIGH_DELAY_JIFFIES); + return penalty_jiffies * nr_pages / MEMCG_CHARGE_BATCH; } /* @@ -2422,6 +2415,13 @@ void mem_cgroup_handle_over_high(void) mem_find_max_overage(memcg)); /* + * Clamp the max delay per usermode return so as to still keep the + * application moving forwards and also permit diagnostics, albeit + * extremely slowly. + */ + penalty_jiffies = min(penalty_jiffies, MEMCG_MAX_HIGH_DELAY_JIFFIES); + + /* * Don't sleep if the amount of jiffies this memcg owes us is so low * that it's not even worth doing, in an attempt to be nice to those who * go only a small amount over their memory.high value and maybe haven't _ Patches currently in -mm which might be from kuba@xxxxxxxxxx are mm-prepare-for-swap-over-high-accounting-and-penalty-calculation.patch mm-move-penalty-delay-clamping-out-of-calculate_high_delay.patch mm-move-cgroup-high-memory-limit-setting-into-struct-page_counter.patch mm-automatically-penalize-tasks-with-high-swap-use.patch