The patch titled Subject: mm: vmscan: check if mem cgroup is disabled or not before calling memcg slab shrinker has been added to the -mm tree. Its filename is mm-vmscan-check-if-mem-cgroup-is-disabled-or-not-before-calling-memcg-slab-shrinker.patch
This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-vmscan-check-if-mem-cgroup-is-di... and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-vmscan-check-if-mem-cgroup-is-di...
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: Yang Shi yang.shi@linux.alibaba.com Subject: mm: vmscan: check if mem cgroup is disabled or not before calling memcg slab shrinker
Shakeel Butt reported premature oom on kernel with "cgroup_disable=memory" since mem_cgroup_is_root() returns false even though memcg is actually NULL. The drop_caches is also broken.
It is because aeed1d325d42 ("mm/vmscan.c: generalize shrink_slab() calls in shrink_node()") removed the !memcg check before !mem_cgroup_is_root(). And, surprisingly root memcg is allocated even though memory cgroup is disabled by kernel boot parameter.
Add mem_cgroup_disabled() check to make reclaimer work as expected.
Link: http://lkml.kernel.org/r/1563385526-20805-1-git-send-email-yang.shi@linux.al... Fixes: aeed1d325d42 ("mm/vmscan.c: generalize shrink_slab() calls in shrink_node()") Signed-off-by: Yang Shi yang.shi@linux.alibaba.com Reported-by: Shakeel Butt shakeelb@google.com Reviewed-by: Shakeel Butt shakeelb@google.com Reviewed-by: Kirill Tkhai ktkhai@virtuozzo.com Cc: Vladimir Davydov vdavydov.dev@gmail.com Cc: Johannes Weiner hannes@cmpxchg.org Cc: Michal Hocko mhocko@suse.com Cc: Roman Gushchin guro@fb.com Cc: Hugh Dickins hughd@google.com Cc: Qian Cai cai@lca.pw Cc: Kirill A. Shutemov kirill.shutemov@linux.intel.com Cc: stable@vger.kernel.org [4.19+] Signed-off-by: Andrew Morton akpm@linux-foundation.org ---
mm/vmscan.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
--- a/mm/vmscan.c~mm-vmscan-check-if-mem-cgroup-is-disabled-or-not-before-calling-memcg-slab-shrinker +++ a/mm/vmscan.c @@ -699,7 +699,14 @@ static unsigned long shrink_slab(gfp_t g unsigned long ret, freed = 0; struct shrinker *shrinker;
- if (!mem_cgroup_is_root(memcg)) + /* + * The root memcg might be allocated even though memcg is disabled + * via "cgroup_disable=memory" boot parameter. This could make + * mem_cgroup_is_root() return false, then just run memcg slab + * shrink, but skip global shrink. This may result in premature + * oom. + */ + if (!mem_cgroup_disabled() && !mem_cgroup_is_root(memcg)) return shrink_slab_memcg(gfp_mask, nid, memcg, priority);
if (!down_read_trylock(&shrinker_rwsem)) _
Patches currently in -mm which might be from yang.shi@linux.alibaba.com are
revert-kmemleak-allow-to-coexist-with-fault-injection.patch mm-vmscan-check-if-mem-cgroup-is-disabled-or-not-before-calling-memcg-slab-shrinker.patch mm-mempolicy-make-the-behavior-consistent-when-mpol_mf_move-and-mpol_mf_strict-were-specified.patch mm-mempolicy-handle-vma-with-unmovable-pages-mapped-correctly-in-mbind.patch mm-thp-make-transhuge_vma_suitable-available-for-anonymous-thp.patch mm-thp-make-transhuge_vma_suitable-available-for-anonymous-thp-v4.patch mm-thp-fix-false-negative-of-shmem-vmas-thp-eligibility.patch
linux-stable-mirror@lists.linaro.org