mm: don't pass "enum lru_list" to lru list addition functions
The "enum lru_list" parameter to add_page_to_lru_list() and add_page_to_lru_list_tail() is redundant in the sense that it can be extracted from the "struct page" parameter by page_lru(). A caveat is that we need to make sure PageActive() or PageUnevictable() is correctly set or cleared before calling these two functions. And they are indeed. Link: https://lore.kernel.org/linux-mm/20201207220949.830352-4-yuzhao@google.com/ Link: https://lkml.kernel.org/r/20210122220600.906146-4-yuzhao@google.com Signed-off-by: Yu Zhao <yuzhao@google.com> Cc: Alex Shi <alex.shi@linux.alibaba.com> Cc: Hugh Dickins <hughd@google.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Matthew Wilcox <willy@infradead.org> Cc: Michal Hocko <mhocko@kernel.org> Cc: Roman Gushchin <guro@fb.com> Cc: Vladimir Davydov <vdavydov.dev@gmail.com> Cc: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
@@ -1867,7 +1867,7 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec,
|
||||
* inhibits memcg migration).
|
||||
*/
|
||||
VM_BUG_ON_PAGE(!lruvec_holds_page_lru_lock(page, lruvec), page);
|
||||
add_page_to_lru_list(page, lruvec, page_lru(page));
|
||||
add_page_to_lru_list(page, lruvec);
|
||||
nr_pages = thp_nr_pages(page);
|
||||
nr_moved += nr_pages;
|
||||
if (PageActive(page))
|
||||
@@ -4282,12 +4282,10 @@ void check_move_unevictable_pages(struct pagevec *pvec)
|
||||
|
||||
lruvec = relock_page_lruvec_irq(page, lruvec);
|
||||
if (page_evictable(page) && PageUnevictable(page)) {
|
||||
enum lru_list lru = page_lru_base_type(page);
|
||||
|
||||
VM_BUG_ON_PAGE(PageActive(page), page);
|
||||
ClearPageUnevictable(page);
|
||||
del_page_from_lru_list(page, lruvec, LRU_UNEVICTABLE);
|
||||
add_page_to_lru_list(page, lruvec, lru);
|
||||
add_page_to_lru_list(page, lruvec);
|
||||
pgrescued += nr_pages;
|
||||
}
|
||||
SetPageLRU(page);
|
||||
|
||||
Reference in New Issue
Block a user