summaryrefslogtreecommitdiffstats
path: root/mm/swap_state.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2022-05-13 05:23:02 +0200
committerAndrew Morton <akpm@linux-foundation.org>2022-05-13 16:20:15 +0200
commite2e3fdc7d4afdb8e7ba981eba7827993f2d390a8 (patch)
treef747a326065eb01d0e328a79751b06f464dd5292 /mm/swap_state.c
parentvmscan: convert the writeback handling in shrink_page_list() to folios (diff)
downloadlinux-e2e3fdc7d4afdb8e7ba981eba7827993f2d390a8.tar.xz
linux-e2e3fdc7d4afdb8e7ba981eba7827993f2d390a8.zip
swap: turn get_swap_page() into folio_alloc_swap()
This removes an assumption that a large folio is HPAGE_PMD_NR pages in size. Link: https://lkml.kernel.org/r/20220504182857.4013401-8-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/swap_state.c')
-rw-r--r--mm/swap_state.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/swap_state.c b/mm/swap_state.c
index 27c4e28f795f..2dc0d02f8d79 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -184,13 +184,14 @@ void __delete_from_swap_cache(struct page *page,
*/
int add_to_swap(struct page *page)
{
+ struct folio *folio = page_folio(page);
swp_entry_t entry;
int err;
VM_BUG_ON_PAGE(!PageLocked(page), page);
VM_BUG_ON_PAGE(!PageUptodate(page), page);
- entry = get_swap_page(page);
+ entry = folio_alloc_swap(folio);
if (!entry.val)
return 0;