Re: [PATCH v2 3/4] mm/shmem, swap: improve mthp swapin process
From: YoungJun Park
Date: Fri Jun 20 2025 - 03:53:41 EST
On Fri, Jun 20, 2025 at 01:55:37AM +0800, Kairui Song wrote:
> + if (skip_swapcache) {
> + swapcache_clear(si, folio->swap, folio_nr_pages(folio));
> + folio->swap.val = 0;
> }
> + if (folio)
> + folio_put(folio);
> put_swap_device(si);
I really appreciate the patch. great work!
It's a rather trivial point, but I was wondering if the following change
might make sense:
...
if (skip_swapcache)
swapcache_clear(si, folio->swap, folio_nr_pages(folio));
put_swap_device(si);
if (folio)
folio_put(folio);
return error;
...
My intention here is to minimize the reference to si,
and from what I understand, this folio has already been allocated and would
soon disappear. Is it possible to to reduce the clear operation?
(folio->swap.val = 0)
Just a small suggestion.
Thank you again for your work!
Regards,
Youngjun Park