diff options
author | Junaid Shahid <junaids@google.com> | 2018-06-07 20:07:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-07 20:34:36 -0400 |
commit | d12c60f64cf8c768fddfd848eaf7ee57a13f18b1 (patch) | |
tree | a85f422f1f49ede486955d820b9023ac90fa5dfe /mm | |
parent | bb4a7ea2b1449722cec9d787dca5a74ca36e8eeb (diff) |
mm: memcontrol: drain memcg stock on force_empty
The per-cpu memcg stock can retain a charge of upto 32 pages. On a
machine with large number of cpus, this can amount to a decent amount of
memory. Additionally force_empty interface might be triggering unneeded
memcg reclaims.
Link: http://lkml.kernel.org/r/20180507201651.165879-1-shakeelb@google.com
Signed-off-by: Junaid Shahid <junaids@google.com>
Signed-off-by: Shakeel Butt <shakeelb@google.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memcontrol.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 18dcdac0b158..e6de0d6a3a8d 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -2610,6 +2610,9 @@ static int mem_cgroup_force_empty(struct mem_cgroup *memcg) | |||
2610 | 2610 | ||
2611 | /* we call try-to-free pages for make this cgroup empty */ | 2611 | /* we call try-to-free pages for make this cgroup empty */ |
2612 | lru_add_drain_all(); | 2612 | lru_add_drain_all(); |
2613 | |||
2614 | drain_all_stock(memcg); | ||
2615 | |||
2613 | /* try to free all pages in this cgroup */ | 2616 | /* try to free all pages in this cgroup */ |
2614 | while (nr_retries && page_counter_read(&memcg->memory)) { | 2617 | while (nr_retries && page_counter_read(&memcg->memory)) { |
2615 | int progress; | 2618 | int progress; |