shake_folio()'s lru_add_drain_all() no longer serves a purpose, now that the per-cpu fbatch references are gone. Are the retries in get_any_page() then still useful? Not obvious, so keep them. Signed-off-by: Hugh Dickins --- mm/hwpoison-inject.c | 1 - mm/internal.h | 1 - mm/memory-failure.c | 38 +------------------------------------- 3 files changed, 1 insertion(+), 39 deletions(-) diff --git a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c index a11222572f97..9eab4b7d25b2 100644 --- a/mm/hwpoison-inject.c +++ b/mm/hwpoison-inject.c @@ -118,7 +118,6 @@ static int hwpoison_inject(void *data, u64 val) if (!hwpoison_filter_enable) goto inject; - shake_folio(folio); /* * This implies unable to support non-LRU pages except free page. */ diff --git a/mm/internal.h b/mm/internal.h index ff4bd3a14539..9a25552cbd83 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1140,7 +1140,6 @@ static inline bool node_reclaim_enabled(void) */ #ifdef CONFIG_MEMORY_FAILURE int unmap_poisoned_folio(struct folio *folio, unsigned long pfn, bool must_kill); -void shake_folio(struct folio *folio); typedef int hwpoison_filter_func_t(struct page *p); void hwpoison_filter_register(hwpoison_filter_func_t *filter); void hwpoison_filter_unregister(void); diff --git a/mm/memory-failure.c b/mm/memory-failure.c index aaf14608b30e..2a6a01e260ed 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -310,30 +310,6 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags) return ret; } -/* - * Unknown page type encountered. Try to check whether it can turn PageLRU by - * lru_add_drain_all. - */ -void shake_folio(struct folio *folio) -{ - if (folio_test_hugetlb(folio)) - return; - /* - * TODO: Could shrink slab caches here if a lightweight range-based - * shrinker will be available. - */ - if (folio_test_slab(folio)) - return; - - lru_add_drain_all(); -} -EXPORT_SYMBOL_GPL(shake_folio); - -static void shake_page(struct page *page) -{ - shake_folio(page_folio(page)); -} - static unsigned long dev_pagemap_mapping_shift(struct vm_area_struct *vma, unsigned long address) { @@ -1459,10 +1435,8 @@ static int get_any_page(struct page *p, unsigned long flags) * We raced with (possibly temporary) unhandlable * page, retry. */ - if (pass++ < GET_PAGE_MAX_RETRY_NUM) { - shake_page(p); + if (pass++ < GET_PAGE_MAX_RETRY_NUM) goto try_again; - } ret = -EIO; goto out; } @@ -1477,7 +1451,6 @@ static int get_any_page(struct page *p, unsigned long flags) */ if (pass++ < GET_PAGE_MAX_RETRY_NUM) { put_page(p); - shake_page(p); count_increased = false; goto try_again; } @@ -1627,7 +1600,6 @@ static bool hwpoison_user_mappings(struct folio *folio, struct page *p, LIST_HEAD(tokill); bool unmap_success; bool forcekill; - bool mlocked = folio_test_mlocked(folio); /* * Here we are interested only in user-mapped pages, so skip any @@ -1658,13 +1630,6 @@ static bool hwpoison_user_mappings(struct folio *folio, struct page *p, pr_err("%#lx: failed to unmap page (folio mapcount=%d)\n", pfn, folio_mapcount(folio)); - /* - * try_to_unmap() might put mlocked page in lru cache, so call - * shake_page() again to ensure that it's flushed. - */ - if (mlocked) - shake_folio(folio); - /* * Now that the dirty bit has been propagated to the * struct page and all unmaps done we can decide if @@ -2554,7 +2519,6 @@ int memory_failure(unsigned long pfn, int flags) * The check (unnecessarily) ignores LRU pages being isolated and * walked by the page reclaim code, however that's not a big loss. */ - shake_folio(folio); folio_lock(folio); -- 2.51.0