+ mm-dont-skip-memory-guarantee-calculations.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm, memcg: don't skip memory guarantee calculations
has been added to the -mm tree.  Its filename is
     mm-dont-skip-memory-guarantee-calculations.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-dont-skip-memory-guarantee-calculations.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-dont-skip-memory-guarantee-calculations.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: Roman Gushchin <guro@xxxxxx>
Subject: mm, memcg: don't skip memory guarantee calculations

There are two cases when effective memory guarantee calculation is
mistakenly skipped:

1) If memcg is a child of the root cgroup, and the root cgroup is not
   root_mem_cgroup (in other words, if the reclaim is targeted). 
   Top-level memory cgroups are handled specially in
   mem_cgroup_protected(), because the root memory cgroup doesn't have
   memory guarantee and can't limit its children guarantees.  So, all
   effective guarantee calculation is skipped.  But in case of targeted
   reclaim things are different: cgroups, which parent exceeded its memory
   limit aren't special.

2) If memcg has no charged memory (memory usage is 0).  In this case
   mem_cgroup_protected() always returns MEMCG_PROT_NONE, which is correct
   and prevents to generate fake memory low events for empty cgroups.  But
   skipping memory emin/elow calculation is wrong: if there is no global
   memory pressure there might be no good chance again, so we can end up
   with effective guarantees set to 0 without any reason.

Link: http://lkml.kernel.org/r/20180522132528.23769-2-guro@xxxxxx
Signed-off-by: Roman Gushchin <guro@xxxxxx>
Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxxxx>
Cc: Vladimir Davydov <vdavydov.dev@xxxxxxxxx>
Cc: Greg Thelen <gthelen@xxxxxxxxxx>
Cc: Tejun Heo <tj@xxxxxxxxxx>
Cc: Shuah Khan <shuah@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/memcontrol.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff -puN mm/memcontrol.c~mm-dont-skip-memory-guarantee-calculations mm/memcontrol.c
--- a/mm/memcontrol.c~mm-dont-skip-memory-guarantee-calculations
+++ a/mm/memcontrol.c
@@ -5809,20 +5809,15 @@ enum mem_cgroup_protection mem_cgroup_pr
 	if (mem_cgroup_disabled())
 		return MEMCG_PROT_NONE;
 
-	if (!root)
-		root = root_mem_cgroup;
-	if (memcg == root)
+	if (memcg == root_mem_cgroup)
 		return MEMCG_PROT_NONE;
 
 	usage = page_counter_read(&memcg->memory);
-	if (!usage)
-		return MEMCG_PROT_NONE;
-
 	emin = memcg->memory.min;
 	elow = memcg->memory.low;
 
 	parent = parent_mem_cgroup(memcg);
-	if (parent == root)
+	if (parent == root_mem_cgroup)
 		goto exit;
 
 	parent_emin = READ_ONCE(parent->memory.emin);
@@ -5857,6 +5852,12 @@ exit:
 	memcg->memory.emin = emin;
 	memcg->memory.elow = elow;
 
+	if (root && memcg == root)
+		return MEMCG_PROT_NONE;
+
+	if (!usage)
+		return MEMCG_PROT_NONE;
+
 	if (usage <= emin)
 		return MEMCG_PROT_MIN;
 	else if (usage <= elow)
_

Patches currently in -mm which might be from guro@xxxxxx are

mm-rename-page_counters-count-limit-into-usage-max.patch
mm-memorylow-hierarchical-behavior.patch
mm-treat-memorylow-value-inclusive.patch
mm-docs-describe-memorylow-refinements.patch
mm-introduce-memorymin.patch
mm-introduce-memorymin-fix.patch
mm-oom-refactor-the-oom_kill_process-function.patch
mm-implement-mem_cgroup_scan_tasks-for-the-root-memory-cgroup.patch
mm-oom-cgroup-aware-oom-killer.patch
mm-oom-introduce-memoryoom_group.patch
mm-oom-introduce-memoryoom_group-fix.patch
mm-oom-add-cgroup-v2-mount-option-for-cgroup-aware-oom-killer.patch
mm-oom-docs-describe-the-cgroup-aware-oom-killer.patch
mm-oom-docs-describe-the-cgroup-aware-oom-killer-fix.patch
cgroup-list-groupoom-in-cgroup-features.patch
mm-fix-oom_kill-event-handling.patch
mm-propagate-memory-effective-protection-on-setting-memorymin-low.patch
mm-dont-skip-memory-guarantee-calculations.patch
selftests-cgroup-add-test-for-memorylow-corner-cases.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux