Commit 280d724a authored by Vishal Moola (Oracle)'s avatar Vishal Moola (Oracle) Committed by Andrew Morton

mm/migrate: convert putback_movable_pages() to use folios

Removes 6 calls to compound_head(), and replaces putback_movable_page()
with putback_movable_folio() as well.

Link: https://lkml.kernel.org/r/20230130214352.40538-5-vishal.moola@gmail.comSigned-off-by: default avatarVishal Moola (Oracle) <vishal.moola@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 19979497
...@@ -129,12 +129,12 @@ int isolate_movable_page(struct page *page, isolate_mode_t mode) ...@@ -129,12 +129,12 @@ int isolate_movable_page(struct page *page, isolate_mode_t mode)
return -EBUSY; return -EBUSY;
} }
static void putback_movable_page(struct page *page) static void putback_movable_folio(struct folio *folio)
{ {
const struct movable_operations *mops = page_movable_ops(page); const struct movable_operations *mops = folio_movable_ops(folio);
mops->putback_page(page); mops->putback_page(&folio->page);
ClearPageIsolated(page); folio_clear_isolated(folio);
} }
/* /*
...@@ -147,33 +147,33 @@ static void putback_movable_page(struct page *page) ...@@ -147,33 +147,33 @@ static void putback_movable_page(struct page *page)
*/ */
void putback_movable_pages(struct list_head *l) void putback_movable_pages(struct list_head *l)
{ {
struct page *page; struct folio *folio;
struct page *page2; struct folio *folio2;
list_for_each_entry_safe(page, page2, l, lru) { list_for_each_entry_safe(folio, folio2, l, lru) {
if (unlikely(PageHuge(page))) { if (unlikely(folio_test_hugetlb(folio))) {
folio_putback_active_hugetlb(page_folio(page)); folio_putback_active_hugetlb(folio);
continue; continue;
} }
list_del(&page->lru); list_del(&folio->lru);
/* /*
* We isolated non-lru movable page so here we can use * We isolated non-lru movable folio so here we can use
* __PageMovable because LRU page's mapping cannot have * __PageMovable because LRU folio's mapping cannot have
* PAGE_MAPPING_MOVABLE. * PAGE_MAPPING_MOVABLE.
*/ */
if (unlikely(__PageMovable(page))) { if (unlikely(__folio_test_movable(folio))) {
VM_BUG_ON_PAGE(!PageIsolated(page), page); VM_BUG_ON_FOLIO(!folio_test_isolated(folio), folio);
lock_page(page); folio_lock(folio);
if (PageMovable(page)) if (folio_test_movable(folio))
putback_movable_page(page); putback_movable_folio(folio);
else else
ClearPageIsolated(page); folio_clear_isolated(folio);
unlock_page(page); folio_unlock(folio);
put_page(page); folio_put(folio);
} else { } else {
mod_node_page_state(page_pgdat(page), NR_ISOLATED_ANON + node_stat_mod_folio(folio, NR_ISOLATED_ANON +
page_is_file_lru(page), -thp_nr_pages(page)); folio_is_file_lru(folio), -folio_nr_pages(folio));
putback_lru_page(page); folio_putback_lru(folio);
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment