[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMgjq7Dy1ma_jq-AutAGjOXfinFPOLVJatz7dnHi_Nc563q2cA@mail.gmail.com>
Date: Fri, 5 Sep 2025 00:05:39 +0800
From: Kairui Song <ryncsn@...il.com>
To: Nhat Pham <nphamcs@...il.com>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
Matthew Wilcox <willy@...radead.org>, Hugh Dickins <hughd@...gle.com>, Chris Li <chrisl@...nel.org>,
Barry Song <baohua@...nel.org>, Baoquan He <bhe@...hat.com>,
Kemeng Shi <shikemeng@...weicloud.com>, Baolin Wang <baolin.wang@...ux.alibaba.com>,
Ying Huang <ying.huang@...ux.alibaba.com>, Johannes Weiner <hannes@...xchg.org>,
David Hildenbrand <david@...hat.com>, Yosry Ahmed <yosryahmed@...gle.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, Zi Yan <ziy@...dia.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/9] mm, swap: use unified helper for swap cache look up
On Thu, Sep 4, 2025 at 2:10 AM Nhat Pham <nphamcs@...il.com> wrote:
>
> On Fri, Aug 22, 2025 at 12:20 PM Kairui Song <ryncsn@...il.com> wrote:
> >
> > From: Kairui Song <kasong@...cent.com>
> >
> > Always use swap_cache_get_folio for swap cache folio look up. The reason
> > we are not using it in all places is that it also updates the readahead
> > info, and some callsites want to avoid that.
> >
> > So decouple readahead update with swap cache lookup into a standalone
> > helper, let the caller call the readahead update helper if that's
> > needed. 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. Following commits will wrap their
> > accesses to the swap cache too with special helpers.
> >
> > Signed-off-by: Kairui Song <kasong@...cent.com>
>
> My personal taste is we should have one patch to do the decoupling of
> readahead update and the swapcache lookup, then another patch to use
> the swapcache lookup helper in places that previously cannot be used
> (due to the coupling of swapcache and readahead).
>
> But, this looks good to me :) Feel free to add:
>
> Acked-by: Nhat Pham <nphamcs@...il.com>
>
Thanks, I think I'll just drop the readahead update for now, it is
harmless to keep it out of the lock and it's really small change, I
didn't measure anything different either way.
We may test and figure out how to read ahead better later, not really
related to this series.
Powered by blists - more mailing lists