From e841cc9cb0a7e9ccdab087a5c983066e0e06757f Mon Sep 17 00:00:00 2001 From: Alex Shi Date: Wed, 7 Jul 2021 10:17:29 +0800 Subject: [PATCH] mm/vmscan: remove lruvec reget in move_pages_to_lru MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mainline inclusion from mainline-v5.11-rc1 commit afca9157fd426451eb182c9de4bfe4b9382a873a category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I3ZF7C?from=project-issue CVE: NA -------------------------------------- Isolated page shouldn't be recharged by memcg since the memcg migration isn't possible at the time. All pages were isolated from the same lruvec (and isolation inhibits memcg migration). So remove unnecessary regetting. Thanks to Alexander Duyck for pointing this out. Link: https://lkml.kernel.org/r/1604566549-62481-12-git-send-email-alex.shi@linux.alibaba.com Signed-off-by: Alex Shi Acked-by: Hugh Dickins Acked-by: Johannes Weiner Cc: Konstantin Khlebnikov Cc: Michal Hocko Cc: Alexander Duyck Cc: Andrea Arcangeli Cc: Andrey Ryabinin Cc: "Chen, Rong A" Cc: Daniel Jordan Cc: "Huang, Ying" Cc: Jann Horn Cc: Joonsoo Kim Cc: Kirill A. Shutemov Cc: Kirill A. Shutemov Cc: Matthew Wilcox (Oracle) Cc: Mel Gorman Cc: Michal Hocko Cc: Mika Penttilä Cc: Minchan Kim Cc: Shakeel Butt Cc: Tejun Heo Cc: Thomas Gleixner Cc: Vladimir Davydov Cc: Vlastimil Babka Cc: Wei Yang Cc: Yang Shi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Jing Xiangfeng Reviewed-by: chenwandun Signed-off-by: Zheng Zengkai --- mm/vmscan.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index e366ac953d38..8e6dfc5386c9 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1890,7 +1890,12 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec, continue; } - lruvec = mem_cgroup_page_lruvec(page, pgdat); + /* + * All pages were isolated from the same lruvec (and isolation + * inhibits memcg migration). + */ + VM_BUG_ON_PAGE(mem_cgroup_page_lruvec(page, page_pgdat(page)) + != lruvec, page); lru = page_lru(page); nr_pages = thp_nr_pages(page); -- GitLab