All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/memcontrol.c: drains percpu charge caches in memory.reclaim
@ 2022-11-10  6:53 ` Lu Jialin
  0 siblings, 0 replies; 14+ messages in thread
From: Lu Jialin @ 2022-11-10  6:53 UTC (permalink / raw)
  To: Johannes Weiner, Andrew Morton, Michal Hocko, Roman Gushchin,
	Shakeel Butt, Muchun Song
  Cc: Lu Jialin, cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg

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


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-11-11 20:31 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-10  6:53 [PATCH] mm/memcontrol.c: drains percpu charge caches in memory.reclaim Lu Jialin
2022-11-10  6:53 ` Lu Jialin
     [not found] ` <20221110065316.67204-1-lujialin4-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2022-11-10 14:42   ` Michal Koutný
2022-11-10 14:42     ` Michal Koutný
     [not found]     ` <20221110144243.GA10562-9OudH3eul5jcvrawFnH+a6VXKuFTiq87@public.gmane.org>
2022-11-10 19:35       ` Yosry Ahmed
2022-11-10 19:35         ` Yosry Ahmed
     [not found]         ` <CAJD7tkat6QAJkPJ-of0xYGbKJ1CyXeC0cMh+U9Nzmddm4pOZ9g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
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ý
     [not found]             ` <20221111100843.GG20455-9OudH3eul5jcvrawFnH+a6VXKuFTiq87@public.gmane.org>
2022-11-11 18:24               ` Yosry Ahmed
2022-11-11 18:24                 ` Yosry Ahmed
     [not found]                 ` <CAJD7tkYWvR+2o==-R38hDBEM=k=2bta9kKRND3wxDLF1pWbp6A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-11-11 20:31                   ` Johannes Weiner
2022-11-11 20:31                     ` Johannes Weiner

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.