Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: Tal Zussman <tz2294@columbia.edu>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	 Chris Li <chrisl@kernel.org>, Kairui Song <kasong@tencent.com>,
	 Kemeng Shi <shikemeng@huaweicloud.com>,
	Nhat Pham <nphamcs@gmail.com>, Baoquan He <baoquan.he@linux.dev>,
	 Barry Song <baohua@kernel.org>,
	Youngjun Park <youngjun.park@lge.com>,
	 David Hildenbrand <david@kernel.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	 Vlastimil Babka <vbabka@kernel.org>,
	Mike Rapoport <rppt@kernel.org>,
	 Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	 Matthew Wilcox <willy@infradead.org>,
	Christoph Hellwig <hch@lst.de>,
	 Johannes Weiner <hannes@cmpxchg.org>,
	Yosry Ahmed <yosry@kernel.org>,
	 Chengming Zhou <chengming.zhou@linux.dev>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/6] mm/page_io: use swap entries directly in zeromap helpers
Date: Mon, 10 Aug 2026 15:49:31 +0100	[thread overview]
Message-ID: <annizMfrtB64wMCW@lucifer> (raw)
In-Reply-To: <bc25141c-753a-4280-83fd-a7e2e2a2db6d@columbia.edu>

On Mon, Aug 10, 2026 at 04:14:45PM +0300, Tal Zussman wrote:
> On 8/10/26 8:55 AM, Lorenzo Stoakes (ARM) wrote:
> > On Thu, Aug 06, 2026 at 06:55:35PM -0400, Tal Zussman wrote:
> >> Increment swp_entry_t::val directly instead of recomputing each entry
> >> with page_swap_entry(). This removes the last struct page usage in
> >> page_io.c and saves one call to compound_head() per page.
> >>
> >> Signed-off-by: Tal Zussman <tz2294@columbia.edu>
> >
> > Lord I just looked at page_swap_entry() and... yeah. This is an improvement
> > thanks :)
> >
> > I haven't looked at the rest of the series so maybe you already did it but I
> > wonder if we could remove it altogether?
> >
>
> Indeed we can - I have ~7 more patches which do exactly that, but they're more
> wide-ranging (rmap, zswap, huge_memory, swapfile, arm64 MTE), so I kept them
> separate from this.
>
> I believe Andrew is planning to pick this up post-rc1, so I'll probably send
> them out then since they rely on some of these changes.

Cool. Never fear the churn, as long as it's achieving things that have good RoI
(this definitely does) then we're all good ;)

And yeah probably best to send rest at 7.3-rc1 to queue up for 7.4. We're trying
to gradually keep the merge window vaguely sane-ish :)

>
> > Should we rename page_io.c to folio_io.c now? :P
> >
> > Anyway LGTM so:
> >
> > Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> >
>
> Thanks!
>
> >> ---
> >>  mm/page_io.c | 8 ++++----
> >>  1 file changed, 4 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/mm/page_io.c b/mm/page_io.c
> >> index 43b4383a4729..c6d0949b3f1e 100644
> >> --- a/mm/page_io.c
> >> +++ b/mm/page_io.c
> >> @@ -159,7 +159,7 @@ static void swap_zeromap_folio_set(struct folio *folio)
> >>  	struct obj_cgroup *objcg = get_obj_cgroup_from_folio(folio);
> >>  	int nr_pages = folio_nr_pages(folio);
> >>  	struct swap_cluster_info *ci;
> >> -	swp_entry_t entry;
> >> +	swp_entry_t entry = folio->swap;
> >>  	unsigned int i;
> >>
> >>  	VM_WARN_ON_ONCE_FOLIO(!folio_test_swapcache(folio), folio);
> >> @@ -167,8 +167,8 @@ static void swap_zeromap_folio_set(struct folio *folio)
> >>
> >>  	ci = swap_cluster_get_and_lock(folio);
> >>  	for (i = 0; i < folio_nr_pages(folio); i++) {
> >> -		entry = page_swap_entry(folio_page(folio, i));
> >>  		__swap_table_set_zero(ci, swp_cluster_offset(entry));
> >> +		entry.val++;
> >>  	}
> >>  	swap_cluster_unlock(ci);
> >>
> >> @@ -182,7 +182,7 @@ static void swap_zeromap_folio_set(struct folio *folio)
> >>  static void swap_zeromap_folio_clear(struct folio *folio)
> >>  {
> >>  	struct swap_cluster_info *ci;
> >> -	swp_entry_t entry;
> >> +	swp_entry_t entry = folio->swap;
> >>  	unsigned int i;
> >>
> >>  	VM_WARN_ON_ONCE_FOLIO(!folio_test_swapcache(folio), folio);
> >> @@ -190,8 +190,8 @@ static void swap_zeromap_folio_clear(struct folio *folio)
> >>
> >>  	ci = swap_cluster_get_and_lock(folio);
> >>  	for (i = 0; i < folio_nr_pages(folio); i++) {
> >> -		entry = page_swap_entry(folio_page(folio, i));
> >>  		__swap_table_clear_zero(ci, swp_cluster_offset(entry));
> >> +		entry.val++;
> >>  	}
> >>  	swap_cluster_unlock(ci);
> >>  }
> >>
> >> --
> >> 2.39.5
> >>
> >
> > --
> > Cheers, Lorenzo
> >
>

--
Cheers, Lorenzo


  reply	other threads:[~2026-08-10 14:49 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06 22:55 [PATCH 0/6] mm/page_io: folio conversion cleanups Tal Zussman
2026-08-06 22:55 ` [PATCH 1/6] mm/page_io: convert write completion handlers to folios Tal Zussman
2026-08-07 16:49   ` Johannes Weiner
2026-08-07 18:42     ` Matthew Wilcox
2026-08-10 12:50   ` Lorenzo Stoakes (ARM)
2026-08-06 22:55 ` [PATCH 2/6] mm: remove PageReclaim Tal Zussman
2026-08-07 16:50   ` Johannes Weiner
2026-08-07 18:48   ` Matthew Wilcox
2026-08-07 19:27     ` Tal Zussman
2026-08-10 11:38       ` David Hildenbrand (Arm)
2026-08-10 12:51         ` Lorenzo Stoakes (ARM)
2026-08-06 22:55 ` [PATCH 3/6] mm/page_io: use swap entries directly in zeromap helpers Tal Zussman
2026-08-07 16:53   ` Johannes Weiner
2026-08-07 18:50   ` Matthew Wilcox
2026-08-10 12:55   ` Lorenzo Stoakes (ARM)
2026-08-10 13:14     ` Tal Zussman
2026-08-10 14:49       ` Lorenzo Stoakes (ARM) [this message]
2026-08-06 22:55 ` [PATCH 4/6] mm/page_io: rename bio_associate_blkg_from_page() Tal Zussman
2026-08-07 16:53   ` Johannes Weiner
2026-08-07 18:56   ` Matthew Wilcox
2026-08-07 19:30     ` Tal Zussman
2026-08-10 12:55       ` Lorenzo Stoakes (ARM)
2026-08-10 12:57   ` Lorenzo Stoakes (ARM)
2026-08-06 22:55 ` [PATCH 5/6] mm/page_io: refer to folios in swap_writeout() comments Tal Zussman
2026-08-07 16:54   ` Johannes Weiner
2026-08-07 18:59   ` Matthew Wilcox
2026-08-10 12:57   ` Lorenzo Stoakes (ARM)
2026-08-06 22:55 ` [PATCH 6/6] mm/swap: rename __swap_writepage() to __swap_writeout() Tal Zussman
2026-08-07 17:01   ` Johannes Weiner
2026-08-07 19:05     ` Matthew Wilcox
2026-08-10 11:19       ` Tal Zussman
2026-08-07 19:44     ` Tal Zussman
2026-08-10 12:59       ` Lorenzo Stoakes (ARM)
2026-08-10 17:34     ` Christoph Hellwig
2026-08-07 19:06   ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=annizMfrtB64wMCW@lucifer \
    --to=ljs@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baoquan.he@linux.dev \
    --cc=chengming.zhou@linux.dev \
    --cc=chrisl@kernel.org \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=hch@lst.de \
    --cc=kasong@tencent.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=nphamcs@gmail.com \
    --cc=rppt@kernel.org \
    --cc=shikemeng@huaweicloud.com \
    --cc=surenb@google.com \
    --cc=tz2294@columbia.edu \
    --cc=vbabka@kernel.org \
    --cc=willy@infradead.org \
    --cc=yosry@kernel.org \
    --cc=youngjun.park@lge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox