Skip to content

Commit

Permalink
mm: use add_page_to_lru_list()
Browse files Browse the repository at this point in the history
There is add_page_to_lru_list(), and move_pages_to_lru() should reuse
it, not duplicate it.

Link: https://lore.kernel.org/linux-mm/20201207220949.830352-2-yuzhao@google.com/
Signed-off-by: Yu Zhao <yuzhao@google.com>
Reviewed-by: Alex Shi <alex.shi@linux.alibaba.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
  • Loading branch information
yuzhaogoogle authored and xanmod committed Mar 17, 2021
1 parent ddf5dad commit 8cf8a0a
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions mm/vmscan.c
Expand Up @@ -1829,7 +1829,6 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec,
int nr_pages, nr_moved = 0;
LIST_HEAD(pages_to_free);
struct page *page;
enum lru_list lru;

while (!list_empty(list)) {
page = lru_to_page(list);
Expand Down Expand Up @@ -1874,11 +1873,8 @@ 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);
lru = page_lru(page);
add_page_to_lru_list(page, lruvec, page_lru(page));
nr_pages = thp_nr_pages(page);

update_lru_size(lruvec, lru, page_zonenum(page), nr_pages);
list_add(&page->lru, &lruvec->lists[lru]);
nr_moved += nr_pages;
if (PageActive(page))
workingset_age_nonresident(lruvec, nr_pages);
Expand Down

0 comments on commit 8cf8a0a

Please sign in to comment.