From: Lu Jialin <lujialin4@huawei.com> To: Johannes Weiner <hannes@cmpxchg.org>, Andrew Morton <akpm@linux-foundation.org>, Michal Hocko <mhocko@kernel.org>, Roman Gushchin <roman.gushchin@linux.dev>, Shakeel Butt <shakeelb@google.com>, Muchun Song <songmuchun@bytedance.com> Cc: Lu Jialin <lujialin4@huawei.com>, <cgroups@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org> Subject: [PATCH] mm/memcontrol.c: drains percpu charge caches in memory.reclaim Date: Thu, 10 Nov 2022 14:53:16 +0800 [thread overview] Message-ID: <20221110065316.67204-1-lujialin4@huawei.com> (raw) When user use memory.reclaim to reclaim memory, after drain percpu lru caches, drain percpu charge caches for given memcg stock in the hope of introducing more evictable pages. Signed-off-by: Lu Jialin <lujialin4@huawei.com> --- mm/memcontrol.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 2d8549ae1b30..768091cc6a9a 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -6593,10 +6593,13 @@ static ssize_t memory_reclaim(struct kernfs_open_file *of, char *buf, /* * This is the final attempt, drain percpu lru caches in the * hope of introducing more evictable pages for - * try_to_free_mem_cgroup_pages(). + * try_to_free_mem_cgroup_pages(). Also, drain all percpu + * charge caches for given memcg. */ - if (!nr_retries) + if (!nr_retries) { lru_add_drain_all(); + drain_all_stock(memcg); + } reclaimed = try_to_free_mem_cgroup_pages(memcg, nr_to_reclaim - nr_reclaimed, -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Lu Jialin <lujialin4-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> To: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>, Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>, Michal Hocko <mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>, Roman Gushchin <roman.gushchin-fxUVXftIFDnyG1zEObXtfA@public.gmane.org>, Shakeel Butt <shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>, Muchun Song <songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org> Cc: Lu Jialin <lujialin4-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org Subject: [PATCH] mm/memcontrol.c: drains percpu charge caches in memory.reclaim Date: Thu, 10 Nov 2022 14:53:16 +0800 [thread overview] Message-ID: <20221110065316.67204-1-lujialin4@huawei.com> (raw) When user use memory.reclaim to reclaim memory, after drain percpu lru caches, drain percpu charge caches for given memcg stock in the hope of introducing more evictable pages. Signed-off-by: Lu Jialin <lujialin4-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> --- mm/memcontrol.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 2d8549ae1b30..768091cc6a9a 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -6593,10 +6593,13 @@ static ssize_t memory_reclaim(struct kernfs_open_file *of, char *buf, /* * This is the final attempt, drain percpu lru caches in the * hope of introducing more evictable pages for - * try_to_free_mem_cgroup_pages(). + * try_to_free_mem_cgroup_pages(). Also, drain all percpu + * charge caches for given memcg. */ - if (!nr_retries) + if (!nr_retries) { lru_add_drain_all(); + drain_all_stock(memcg); + } reclaimed = try_to_free_mem_cgroup_pages(memcg, nr_to_reclaim - nr_reclaimed, -- 2.17.1
next reply other threads:[~2022-11-10 6:57 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-10 6:53 Lu Jialin [this message] 2022-11-10 6:53 ` [PATCH] mm/memcontrol.c: drains percpu charge caches in memory.reclaim Lu Jialin 2022-11-10 14:42 ` Michal Koutný 2022-11-10 14:42 ` Michal Koutný 2022-11-10 19:35 ` Yosry Ahmed 2022-11-10 19:35 ` Yosry Ahmed 2022-11-10 19:45 ` Yosry Ahmed 2022-11-10 19:45 ` Yosry Ahmed 2022-11-11 10:08 ` Michal Koutný 2022-11-11 10:08 ` Michal Koutný 2022-11-11 18:24 ` Yosry Ahmed 2022-11-11 18:24 ` Yosry Ahmed 2022-11-11 20:31 ` Johannes Weiner 2022-11-11 20:31 ` Johannes Weiner
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221110065316.67204-1-lujialin4@huawei.com \ --to=lujialin4@huawei.com \ --cc=akpm@linux-foundation.org \ --cc=cgroups@vger.kernel.org \ --cc=hannes@cmpxchg.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=mhocko@kernel.org \ --cc=roman.gushchin@linux.dev \ --cc=shakeelb@google.com \ --cc=songmuchun@bytedance.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.