[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2gzofxcv3vbfd5l22drj6p67huf533nq6g2hnurr74ewbrp2gx@f7i6qabbuxng>
Date: Mon, 3 Nov 2025 16:50:48 +0000
From: Yosry Ahmed <yosry.ahmed@...ux.dev>
To: Kairui Song <ryncsn@...il.com>
Cc: Barry Song <baohua@...nel.org>, 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 03, 2025 at 05:02:28PM +0800, Kairui Song wrote:
> 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 mixed up swapping in and swapping out :) I was complaining about
mentioning "swapping out", not vice versa. Sorry for the confusion.
>
> > >
> > > 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.
We do swap the page out, but we use __read_swap_cache_async() to "swap
in" the page from zswap first.
>
> >
> > 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.
Looks good to me. Thanks.
Powered by blists - more mailing lists