diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2024-08-07 21:37:32 +0200 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2024-09-02 05:26:05 +0200 |
commit | 94dc8bffd8b7fe83ba8382a3410a2f218dc20cb0 (patch) | |
tree | efb2372e8f788ee781ef1770654ed0787ed007b5 /mm/swap_state.c | |
parent | mm: remove PG_error (diff) | |
download | linux-94dc8bffd8b7fe83ba8382a3410a2f218dc20cb0.tar.xz linux-94dc8bffd8b7fe83ba8382a3410a2f218dc20cb0.zip |
mm: return the folio from swapin_readahead
The unuse_pte_range() caller only wants the folio while do_swap_page()
wants both the page and the folio. Since do_swap_page() already has logic
for handling both the folio and the page, move the folio-to-page logic
there. This also lets us allocate larger folios in the SWP_SYNCHRONOUS_IO
path in future.
Link: https://lkml.kernel.org/r/20240807193734.1865400-1-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/swap_state.c')
-rw-r--r-- | mm/swap_state.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/mm/swap_state.c b/mm/swap_state.c index 293ff1afdca4..a042720554a7 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -863,13 +863,13 @@ skip: * @gfp_mask: memory allocation flags * @vmf: fault information * - * Returns the struct page for entry and addr, after queueing swapin. + * Returns the struct folio for entry and addr, after queueing swapin. * * It's a main entry function for swap readahead. By the configuration, * it will read ahead blocks by cluster-based(ie, physical disk based) * or vma-based(ie, virtual address based on faulty address) readahead. */ -struct page *swapin_readahead(swp_entry_t entry, gfp_t gfp_mask, +struct folio *swapin_readahead(swp_entry_t entry, gfp_t gfp_mask, struct vm_fault *vmf) { struct mempolicy *mpol; @@ -882,9 +882,7 @@ struct page *swapin_readahead(swp_entry_t entry, gfp_t gfp_mask, swap_cluster_readahead(entry, gfp_mask, mpol, ilx); mpol_cond_put(mpol); - if (!folio) - return NULL; - return folio_file_page(folio, swp_offset(entry)); + return folio; } #ifdef CONFIG_SYSFS |