Re: [PATCH v2 02/15] mm, swap: use unified helper for swap cache look up
From: David Hildenbrand
Date: Mon Sep 08 2025 - 07:44:12 EST
On 05.09.25 21:13, Kairui Song wrote:
From: Kairui Song <kasong@xxxxxxxxxxx>
The swap cache lookup helper swap_cache_get_folio currently does
readahead updates as well, so callers that are not doing swapin from any
VMA or mapping are forced to reuse filemap helpers instead, and have to
access the swap cache space directly.
So decouple readahead update with swap cache lookup. Move the readahead
update part into a standalone helper. Let the caller call the readahead
update helper if they do readahead. And convert all swap cache lookups
to use swap_cache_get_folio.
After this commit, there are only three special cases for accessing swap
cache space now: huge memory splitting, migration, and shmem replacing,
because they need to lock the XArray. The following commits will wrap
their accesses to the swap cache too, with special helpers.
And worth noting, currently dropbehind is not supported for anon folio,
and we will never see a dropbehind folio in swap cache. The unified
helper can be updated later to handle that.
While at it, add proper kernedoc for touched helpers.
No functional change.
Signed-off-by: Kairui Song <kasong@xxxxxxxxxxx>
Acked-by: Chris Li <chrisl@xxxxxxxxxx>
Acked-by: Nhat Pham <nphamcs@xxxxxxxxx>
Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
Reviewed-by: Barry Song <baohua@xxxxxxxxxx>
---
Acked-by: David Hildenbrand <david@xxxxxxxxxx>
--
Cheers
David / dhildenb