From patchwork Wed Dec 13 21:58:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491927 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE422C4332F for ; Wed, 13 Dec 2023 21:59:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B41228D0063; Wed, 13 Dec 2023 16:58:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AF75D8D0062; Wed, 13 Dec 2023 16:58:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F3A18D0063; Wed, 13 Dec 2023 16:58:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 7E2338D0062 for ; Wed, 13 Dec 2023 16:58:56 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5D13A16012C for ; Wed, 13 Dec 2023 21:58:56 +0000 (UTC) X-FDA: 81563160672.09.5528727 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf26.hostedemail.com (Postfix) with ESMTP id BDC0B14001E for ; Wed, 13 Dec 2023 21:58:54 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=aj65zAfI; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702504734; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=6QZrmbGiKC0S/CkXP2LoCsNiQdWX6N+6eWMLbsxIB9A=; b=02spLJAlQWjHEqG3jwifTOSf9NkOLjrt9o9vGMye8eLV9YYrqU9w064tsEr6mlfUS2vKeV bWBtU1hmIpUYAcxCl1pHE8HzB6ZGaqSxAEd+J4f2en6T3ZAmQ3tbSFGY2utaEDWohD0nQh HR/HsP1rnLmQX5zmPyPUS8sCHF832yM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504734; a=rsa-sha256; cv=none; b=XodcaOjnKPVQShGWhDW0vsOFPsGotQqz2IJBI6E0Q5BckmYhWzVTQA3aCtlnpaL4eDBZCf 2qW6m+NinrsBh5qpddkHtTXYE/sbe0hdz4GiJDGd2DQP5W5prYceVDFlz0UQ2WFiQgcNSG ATddpWlZmMg9Uf3WnQCJHu0/R03hS6A= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=aj65zAfI; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=6QZrmbGiKC0S/CkXP2LoCsNiQdWX6N+6eWMLbsxIB9A=; b=aj65zAfImNsXteqVujgkjokdzN vFSzWUWhvNPSp8TZHbTmC9dImr6ZqDUqQUTO/0xybcswhP4fXG5Bb+7cYSixjoubitKyqluSxxYh4 4oOFn/IML6jUhpP+B4g03Ml6LDOp4W7y+4XYZxf6cllgUQuJam8a1YFAhWVvdYQ3Jpt8aj8edjupc +gQQOTrtduTTGEBTYg3aW9F9OD7hQtR8NcIeM79nCaKU0pE1TKS+2iO17vB1Sfuph0gUlZyO+xzuS os//vyzH+Ntp8s32swYaNalW3/RNhtdhOJYDBMnWfzsKCN8/Vv/N8TRDvEDKAsYbFaK7RbsIf3mW2 zlij4Whg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFd-002oiT-KW; Wed, 13 Dec 2023 21:58:45 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 06/13] mm: Pass a folio to swap_readpage_fs() Date: Wed, 13 Dec 2023 21:58:35 +0000 Message-Id: <20231213215842.671461-7-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231213215842.671461-1-willy@infradead.org> References: <20231213215842.671461-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: BDC0B14001E X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: rgkuyjpuchnysi3bdg93z7g4im5wjcu1 X-HE-Tag: 1702504734-919789 X-HE-Meta: U2FsdGVkX19mJmuRZ+uSHby+/c/g4ZGeySgzufKTetnpFLu6HNOWiLfmTaiOntbFRsIB3jvySMM19fasroKRXnfCcgK3BVUzJ+BTZxTauqB8jFhRowEXcTNIqC46pX3uDUrCSGq+KTGv66Pa/e9BE4O6FUNsLtacNXu5CRc1Q29ih8SblWFMGHWrtjYE1fhaZ8OZJme0SfdhW4urPUhZyLO71d6ZRsm7YFD5RebmBIihgAPvZyrR9/hOX34jAENphQJzAZziIGHF2iFFFidoKKl1MB5ta5yTgMsXN1Sevfl7L58G1PkhU4Wv3oAUS7tpneCgNAesFq5uM3KdKFc/lFdNSsp4GGKHwsUEitT3D/nKauonQBh5Qe9yxOVRsmo6g+6KsOfB8IJe29yaoJ6mHJdK+Jm7FMfbQOibIncmO4dOTf47F8CLPN2rSFPi/KtAhYx6ZYqFTxIQYzVn8S+LblpwBrtWIz2euguSTPWmLiK91tYChBtp9LwRF8WG4rpZZMuR8okLcFqn3uS3xIqSIx0XBDqRttlyfxrHH9CUgHtK+66LZou3cfVz4CweovhfyN9ZN7Xpa8JyBkJv8u8uuD3k/Bz68/XAho/rjJQ6QJiMB3hp/br2pwgR03fPaJ0ObE7usv9G6grmCRAdit89R7yUWzAKZszpUtz/KGSRzgNWZYYKNXjIcdKbS4h0Y5+1+gFG+yd+ivNWfkSgdKknRj8e35awHYXjWgyMv8XkCcIDNSSInPKIp8RSw/GHSafXNk1lexLJGD8S9mpbfoWtnyMMOXtcmIENhTXPaoi4YQ0xhqgN4nlaeKvch+RJdaax0GK1U8oL67mUh9oKntk6IRWjmW048C7SoItjHxO3PZJ4PQ9V37qRFy7qONJKWWdQ/vbDVZMCAaEGcK3yTmuely2ZnOZ3yeWeyaEfPY0liHzKxIV6IjBGQH8VOPGFqsTK3XPOTsmv//6hsmIQgKb ePxizYtH dTadQrNcDvEx7GJEzo8NPxZqTF8/7Xx7wk1mFiee+m1gfPfp1fBmDo88RdTsDjRczIvHfzn7L905AFBFHGwPiUaFnIHnhvSZBXZE/oXdaaejCz+NBsFNOnKN/GJgDRuppDL2SUnppqB+0ipymalMU3BXkElGINFWUsqU/7H27m3/u/YkzzMJdQKcq3kCr3TkYUeMtMgi43aCKQKBzEhXn55CocVnPTAPDCsgg X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Saves a call to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/page_io.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 454ab67b33e3..864a558b7b68 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -420,12 +420,11 @@ static void sio_read_complete(struct kiocb *iocb, long ret) mempool_free(sio, sio_pool); } -static void swap_readpage_fs(struct page *page, - struct swap_iocb **plug) +static void swap_readpage_fs(struct folio *folio, struct swap_iocb **plug) { - struct swap_info_struct *sis = page_swap_info(page); + struct swap_info_struct *sis = swp_swap_info(folio->swap); struct swap_iocb *sio = NULL; - loff_t pos = page_file_offset(page); + loff_t pos = folio_file_pos(folio); if (plug) sio = *plug; @@ -444,8 +443,8 @@ static void swap_readpage_fs(struct page *page, sio->pages = 0; sio->len = 0; } - bvec_set_page(&sio->bvec[sio->pages], page, thp_size(page), 0); - sio->len += thp_size(page); + bvec_set_folio(&sio->bvec[sio->pages], folio, folio_size(folio), 0); + sio->len += folio_size(folio); sio->pages += 1; if (sio->pages == ARRAY_SIZE(sio->bvec) || !plug) { swap_read_unplug(sio); @@ -515,7 +514,7 @@ void swap_readpage(struct page *page, bool synchronous, struct swap_iocb **plug) folio_mark_uptodate(folio); folio_unlock(folio); } else if (data_race(sis->flags & SWP_FS_OPS)) { - swap_readpage_fs(page, plug); + swap_readpage_fs(folio, plug); } else if (synchronous || (sis->flags & SWP_SYNCHRONOUS_IO)) { swap_readpage_bdev_sync(page, sis); } else {