From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 549A340A95F for ; Mon, 10 Aug 2026 14:49:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786373394; cv=none; b=RIyFtvmZe1tPLVE1d1sinSZiKNARFFahv8YYLbJ2mleEZR5aGngkkhZ1hAj9E85j8pmL+1sg0lk7h6yLO0NeBZFukgS7mcKr6ckm1tHVIr64I2q3GSgGvKH4oViL1FdZyIJoQndrioDBPjR45CgL+FL6DLYHO/qwpi5npMVtD54= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786373394; c=relaxed/simple; bh=MEO/mLuAuFOzO2uepqWAMAhXErdaXaFGNt3fVZAIUSs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pSq/xtvLAgGtur9BZSC4jLV70+bj4iCC91s5+SNPfaEBIs/EiUXEPqdgmEqR9gB+GfcwdA4c4LppDr9PC0Fy/blioHQoqOEK0I5qfgUhR2K/y1z9uYGn8h3E2tjVjrVxCI1Eh606NHlbDOWV87AXI8QHtqIP5O9kyv/i9xuTcu0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DDLV4D5/; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DDLV4D5/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 191DD1F00A3A; Mon, 10 Aug 2026 14:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786373391; bh=nqYTIOcwqT/VZ1KRSURFM6UpmMmApXfR18VlY6eRteM=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=DDLV4D5/0yK0WFGvOUluF97774da12v0+sqtcBQtZhbJ3o4r6J8hF/tAL8NFofbbJ 0djPxejLipzE+eFd0GVPXFTSvklTL/YNBrlVi4XO0G7an7/exzzdhNV3B9yZpjsi5J 1YEkLvI5WSws0ul3BkoIXrK4efY3JtJmp64/g2vgm2U2HOqw28AaVNGrHUJ6TOb+uT y/XotPFBWsmDTLLf9jaT2SQEC+QCJTPAhY3JWEa1/QcX/um2ao6xSjJ/bTlDTJwSYO W+SpTdW15okBdJdOK6VjCi2LqEVbx9xrwF6+c/yzZESkjT1xV3GwPPF78wtNtkjqow 7X8pjtsjQXZKg== Date: Mon, 10 Aug 2026 15:49:31 +0100 From: "Lorenzo Stoakes (ARM)" To: Tal Zussman Cc: Andrew Morton , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Barry Song , Youngjun Park , David Hildenbrand , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Matthew Wilcox , Christoph Hellwig , Johannes Weiner , Yosry Ahmed , Chengming Zhou , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/6] mm/page_io: use swap entries directly in zeromap helpers Message-ID: References: <20260806-b4-page_io-folios-v1-0-0899bac3b826@columbia.edu> <20260806-b4-page_io-folios-v1-3-0899bac3b826@columbia.edu> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 > > > > 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) > > > > 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