]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - mm/vmscan.c
mm: do not stall register_shrinker()
authorMinchan Kim <minchan@kernel.org>
Mon, 25 Feb 2019 22:26:11 +0000 (19:26 -0300)
committerKhalid Elmously <khalid.elmously@canonical.com>
Thu, 28 Feb 2019 23:03:36 +0000 (18:03 -0500)
commit8daa577370883bcd09d5c38c83c14b1a23fa7eb3
tree0aa6731cf51e3875ba26421755ed00c662ea8710
parent0daa6e883ce1a79e0fac5c9ce10c954f03b33409
mm: do not stall register_shrinker()

BugLink: https://bugs.launchpad.net/bugs/1817628
Shakeel Butt reported he has observed in production systems that the job
loader gets stuck for 10s of seconds while doing a mount operation.  It
turns out that it was stuck in register_shrinker() because some
unrelated job was under memory pressure and was spending time in
shrink_slab().  Machines have a lot of shrinkers registered and jobs
under memory pressure have to traverse all of those memcg-aware
shrinkers and affect unrelated jobs which want to register their own
shrinkers.

To solve the issue, this patch simply bails out slab shrinking if it is
found that someone wants to register a shrinker in parallel.  A downside
is it could cause unfair shrinking between shrinkers.  However, it
should be rare and we can add compilcated logic if we find it's not
enough.

[akpm@linux-foundation.org: tweak code comment]
Link: http://lkml.kernel.org/r/20171115005602.GB23810@bbox
Link: http://lkml.kernel.org/r/1511481899-20335-1-git-send-email-minchan@kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Shakeel Butt <shakeelb@google.com>
Reported-by: Shakeel Butt <shakeelb@google.com>
Tested-by: Shakeel Butt <shakeelb@google.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(backported from commit e496612c5130567fc9d5f1969ca4b86665aa3cbb)
[mfo: refresh one context line for do_shrink_slab() arguments]
Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
Acked-by: Khalid Elmously <khalid.elmously@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
mm/vmscan.c