lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMgjq7A+OBoH71qo=Vt65BeV7M9uOvkJ+9pQX2eq4-tqcKwVwg@mail.gmail.com>
Date: Mon, 3 Nov 2025 17:02:28 +0800
From: Kairui Song <ryncsn@...il.com>
To: Barry Song <baohua@...nel.org>, Yosry Ahmed <yosry.ahmed@...ux.dev>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>, 
	Baoquan He <bhe@...hat.com>, Chris Li <chrisl@...nel.org>, Nhat Pham <nphamcs@...il.com>, 
	Johannes Weiner <hannes@...xchg.org>, David Hildenbrand <david@...hat.com>, 
	Youngjun Park <youngjun.park@....com>, Hugh Dickins <hughd@...gle.com>, 
	Baolin Wang <baolin.wang@...ux.alibaba.com>, 
	"Huang, Ying" <ying.huang@...ux.alibaba.com>, Kemeng Shi <shikemeng@...weicloud.com>, 
	Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, 
	"Matthew Wilcox (Oracle)" <willy@...radead.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 01/19] mm/swap: rename __read_swap_cache_async to swap_cache_alloc_folio

On Mon, Nov 3, 2025 at 4:28 PM Barry Song <baohua@...nel.org> wrote:
> > > +/**
> > > + * swap_cache_alloc_folio - Allocate folio for swapped out slot in swap cache.
> > > + * @entry: the swapped out swap entry to be binded to the folio.
> > > + * @gfp_mask: memory allocation flags
> > > + * @mpol: NUMA memory allocation policy to be applied
> > > + * @ilx: NUMA interleave index, for use only when MPOL_INTERLEAVE
> > > + * @new_page_allocated: sets true if allocation happened, false otherwise
> > > + * @skip_if_exists: if the slot is a partially cached state, return NULL.
> > > + *                  This is a workaround that would be removed shortly.
> > > + *
> > > + * Allocate a folio in the swap cache for one swap slot, typically before
> > > + * doing IO (swap in or swap out). The swap slot indicated by @entry must
> > > + * have a non-zero swap count (swapped out). Currently only supports order 0.

Hi Yosry and Barry, thanks for the review.

> >
> > Is it used for swap in? That's confusing because the next sentence
> > mention that it needs to be already swapped out.

Yes, swap in is the typical user, swap_vma_readahead calls this
function directly, allocate a folio then initiate the swap in IO.

I'm not sure why it is confusing. A swapped out slot getting swapped
in seems a very common thing?

> >
> > I suspect you're referring to the zswap writeback use case, but in this
> > case we're still "swapping-in" the folio from zswap to swap it out to
> > disk. I'd avoid mentioning swap in here because it's confusing.

Oh, I thought the zswap writeback is considered a kind of swap out :),
since it's technically writing data from ram to swap device.

>
> I assume you mean avoiding any mention of swap-out? As for swap-out, we’re
> swapping a folio out from the LRU — we’re not allocating a new folio.
>
> BTW, this sentence also feels a bit odd to me. I’d prefer removing
> “swap out” from
> “doing IO (swap in or swap out)”.

How about "doing IO (e.g. swap in or zswap writeback)"? Swap-in is a
very common user, and zswap writeback can be mentioned explicitly.

>
> Thanks
> Barry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ