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 517093B583B for ; Mon, 10 Aug 2026 12:51:03 +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=1786366265; cv=none; b=ERNFOsp37rCcPG0GEiLIEvvh9r/OkisB5+ZaXgsAxu8CplapbxD5HiknKEilH+kR23VaYHnYCkoCJK+D1lSjzi9uZIChwoiR2/C/7CKhZ8t793q2bESc3X+7GzzUra8bq8zcaTulZLgDy6hKucywHmiqXcVnUhHs+3HulMMSqBo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786366265; c=relaxed/simple; bh=SMnslS2ORaJADCWdYYftJc5IMtDZ/TkT+uvBFvALJ1I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uYWm77xsKAA5jdpqP2BMFAeSaEwE0Ll214py+lonOHQ8GWbbhRC55Vru+kIhPnvHmHxxrr6x5PQsGO+Wm6sCujnCKeY9NOD0QanMlHwKVjE1P9oxZuP5HCrX1VPMzRIa31pG/0cLAXZB75zmdTt9VXkNzbZezjOWJ1WxO4DLmIU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Z3tCqdG1; 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="Z3tCqdG1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C3711F000E9; Mon, 10 Aug 2026 12:50:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786366263; bh=pYvBLcmZ5TB8B2HwmMEA7avd8sv7PgL7yrFAtoQ9v5k=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Z3tCqdG1gTmj5SeDm+uqtFa68CLPgzNb561oUaQ2/m1Zg6lwhm9xGuZBOqR+k0mlx QMw+PKqBPe9IoqTYmc7fORVOR6PfccnvLWskSK1yEQEIIFJjbet0wd5c1XgKKkPFy6 XeGfKVM/47Hcfdy5+fhu5o1blgs/vPsp+pe2wbXY2aR+37OTXhKQTi0Ew6JiShC+dU 10mDX1u19+katUD1OmPV9XavPpNGeD6MBb85mIO3z3SFM7acoWfCd463RjFjrbra8k n8JYtUMFdMOhS27y5QWg7vSKFw6pZIsOhjUR2b4OZzAUNndyd8vXsjPE83goKV6whK 6xPblJ24d7wrA== Date: Mon, 10 Aug 2026 13:50:42 +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 1/6] mm/page_io: convert write completion handlers to folios Message-ID: References: <20260806-b4-page_io-folios-v1-0-0899bac3b826@columbia.edu> <20260806-b4-page_io-folios-v1-1-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: <20260806-b4-page_io-folios-v1-1-0899bac3b826@columbia.edu> On Thu, Aug 06, 2026 at 06:55:33PM -0400, Tal Zussman wrote: > Convert swap_write_end() and swap_fs_write_complete() to operate on > folios directly instead of going through the folio-compat page APIs. > This removes calls to end_page_writeback() and set_page_dirty(), and the > last caller of ClearPageReclaim(), saving two calls to compound_head() > per folio on the write error path. > > Signed-off-by: Tal Zussman Very lovely, thanks! :) I see you remove PageReclaim in the subsequent commit which makes sense as a follow-up. Reviewed-by: Lorenzo Stoakes (ARM) > --- > mm/page_io.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/mm/page_io.c b/mm/page_io.c > index e4fa7ffffe8b..43b4383a4729 100644 > --- a/mm/page_io.c > +++ b/mm/page_io.c > @@ -496,13 +496,13 @@ static void swap_write_end(struct swap_iocb *sio, bool failed) > int p; > > for (p = 0; p < sio->nr_bvecs; p++) { > - struct page *page = sio->bvecs[p].bv_page; > + struct folio *folio = bvec_folio(&sio->bvecs[p]); > > if (failed) { > - set_page_dirty(page); > - ClearPageReclaim(page); > + folio_mark_dirty(folio); > + folio_clear_reclaim(folio); > } > - end_page_writeback(page); > + folio_end_writeback(folio); > } > mempool_free(sio, sio_pool); > } > @@ -513,16 +513,16 @@ static void swap_fs_write_complete(struct kiocb *iocb, long ret) > bool failed = ret != sio->len; > > if (failed) { > - struct page *page = sio->bvecs[0].bv_page; > + struct folio *folio = bvec_folio(&sio->bvecs[0]); > > /* > * In the case of swap-over-nfs, this can be a temporary failure > * if the system has limited memory for allocating transmit > - * buffers. Mark the page dirty and avoid > + * buffers. Mark the folio dirty and avoid > * folio_rotate_reclaimable but rate-limit the messages. > */ > pr_err_ratelimited("Write error %ld on dio swapfile (%llu)\n", > - ret, swap_dev_pos(page_swap_entry(page))); > + ret, swap_dev_pos(folio->swap)); > } > > swap_write_end(sio, failed); > > -- > 2.39.5 > -- Cheers, Lorenzo