Re: [RFC PATCH 00/10] mm/swap: ghost swapfile with backend switching via Redirect entries

From: Nhat Pham

Date: Tue Jul 21 2026 - 15:11:57 EST


On Tue, Jul 21, 2026 at 11:27 AM Nhat Pham <nphamcs@xxxxxxxxx> wrote:
>
>
> 1. If the page is reclaimable, reclaim path will take care of swap cache too.
>
> 2. For non-physical swap users, we actually eagerly attempt to get rid
> of the swap space (and swap cache) once the final reference is
> dropped. Zswap load invalidates the compressed copy, so there's not a
> lot of value in caching. I'm not sure if you missed this or not.

What I meant here was, in should_try_to_free_swap(), I added a check:
if the vswap slot is not backed physical swap slots, try to free it
(folio_free_swap() etc. does check for swap count).

I have tested my code and yes, I did encounter the case you pointed
out. That's why I added that, with comments to justify why etc. I also
had a version of it in the older virtual swap already :)