From patchwork Wed Dec 13 21:58:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491931 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 C55F7C4332F for ; Wed, 13 Dec 2023 21:59:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 356F98D0065; Wed, 13 Dec 2023 16:59:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 262D58D0062; Wed, 13 Dec 2023 16:59:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 090A88D0065; Wed, 13 Dec 2023 16:59:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id E07318D0062 for ; Wed, 13 Dec 2023 16:59:08 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A5E3F14034F for ; Wed, 13 Dec 2023 21:59:08 +0000 (UTC) X-FDA: 81563161176.12.7951194 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf25.hostedemail.com (Postfix) with ESMTP id 05EA6A000C for ; Wed, 13 Dec 2023 21:59:06 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=YZgjIRgw; dmarc=none; spf=none (imf25.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702504747; 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=L5hxk7Y0jVDBtRhrPGAgNnOg5HubQe2zAD3Pwoq6l3s=; b=IbZd/gefxUZl8Xe3e6bCoivvJIkvgkgSUF6DbLP0EZgQgGh+TWNPK6jMQHhCTjdrf8Jv3c jDU0tFKFHYPZYOijd7/meEs3TNS91TUOCQ9RvJPKahoKaod1Y++vC2zV06xUfXe1N0PSnk BACumaSJoeFhB6gLkWTy4sOXKr0vLx0= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=YZgjIRgw; dmarc=none; spf=none (imf25.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504747; a=rsa-sha256; cv=none; b=JaGMQ3KllEhnSl+WWWMhzvdCUbbpf9bLqR1aFwY/RV5joQBIO89UChxjjmTL9/luDsyEaw 3Pa6pqayfzmKfHs2qfs1katPsUNL/Y0wX2mlVNUjfRm0AnTM9V8fbVdAPK7dQwPJLekANC gZ+3NIq1HpNlhoxTTbof5vFx2ZKRcpg= 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=L5hxk7Y0jVDBtRhrPGAgNnOg5HubQe2zAD3Pwoq6l3s=; b=YZgjIRgwMobY2+ao3VaoTLk0KP KScIjZgvGV5Ksm3Y/UkQrTucmTH2iiumDliXBWfb2CysIZqfrYlz8/8eGWkwl2BvZar5Dsgr0z3qM 0d6ZaeyjHol5z3uhl6kg+jKEWzazc7Yz2hjkfxYjPZoOg71u6FInoi1QGHGp4GulQqHXb7V2jGTmJ 6Kgb8lF1x9oXGgoD9MBJuUjTYdDB9DsihOaJ7oWZ6hLS5XUkcUsFxlPOaAM/NN1VFVZp4fXDbNF9y 37299pO4RrWmQRQ7Pj/4eAoP67NVSqLocVYPimDuK4anpVTJM7Po6tOiD4nzkms3FFcA/OHrJ42fZ qu58orbQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFd-002oiR-HX; 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 05/13] mm: Pass a folio to swap_writepage_bdev_async() Date: Wed, 13 Dec 2023 21:58:34 +0000 Message-Id: <20231213215842.671461-6-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-Server: rspam09 X-Rspamd-Queue-Id: 05EA6A000C X-Stat-Signature: kxd1bi5sufjhxthme4pakaef1mrpi15q X-Rspam-User: X-HE-Tag: 1702504746-495923 X-HE-Meta: U2FsdGVkX19UxAloVy20wc2QIw2j+/siXujcVXrST4MQTafvAfY+x+zyfqVwRvl3T3pd6DcgpQLWT0/Z01nJfh1FX47Z+O+90PEaL00rK8qPBbemqnf74nN1YNSfTlLAEMRouXhdLTdx7SHmpz729VxN0dwTgiSEbNGOGUPp/vrzqYKsQo7OsJ1HtSvvA2AFqmFTA5v+DEWHg+MVVdICOPcENf0WwoGq4IOssCLODPfvpDfi4OZeFRz5F0S3pfo/th3KjRPcMFZBW9y+Zw4enKi67Z3TmT6YkCSK0K5kSHZwj8r7DS0x8o3s2dYgwyhK/NKa5uQDVkEwIlC4rBcHIvlHprMKa2ZYQHIuAl91dexGuFv29Q613wn130DWAUcYbTE6r24eD1xg7l8b9QPHOMlc7Bl2h59gt3ssb1oBdOPfjkeNyYAGrrJqFYJLm7MoUWNWVMNZbfj+81x2dn+U+YOTbn2ZMBbRCXWboT49P2a8QRZjixmGXPV2aTPwm1pBOw41fVYcAuEjx9H8Xe/i8yJBsynfJQ9tlZnXIlFTO4l/NX6/Z2GW7ni+f9xrM8cMu0vY+av/bDIH45wJeDOd487kWTspuADlbWihSnoOBOtIvpsatSVhbHUGx4h/ORvNhl6YHMAKylckF3+bWmTqV1fB+2/BfTm/dALZ4CiXx5zzSMiq3vZulU0JN+13UCpF/HjiljzgJ273cxCEYiBRvzflTZrURtAa4rf/XeHP3wKLFit/CLGvjKGZnyOHLNpPJqMQWETNO8avOwBatp44TamuaT2Tx/hkQYp5rtnlaS6htQcuK2yltS74ck4tFWxwfVeHieyWFaXGeLapymiH+/89Q5yH6llB8VyLAPGk+M3JHao6aI1Gk3t6u2cejhvkjtV4VZ4rsdQ6jUaBvxEqrHZPyL2RclX+jmbFhFhts8EfH9Wn4YCDwcDS/nRR/qMSR+La9bwgWpyBXxHdCC4 krnCmYFr xqvU0U+1549su5SpVnLKVwkQz3siYkiYJr82VqIwvXo8CNOCt11mPxDJhh8e0qXfJOnrliK/TSIwslkz49aZLvWeefk3OJo9T3/wN09YAj+QOtcumPcPOfCO+WgrsMf8DuNny51GPJCWwoOIXrIEwc58+RlsLImKkX/uqvQ/pns82NsaRwEWHfRIjQCaKA2CAFznYsnsXQ0cGWTG7JsXa0HpqvOPN5KtCBQ0c 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 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 1f57e26fa282..454ab67b33e3 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -347,18 +347,17 @@ static void swap_writepage_bdev_sync(struct folio *folio, __end_swap_bio_write(&bio); } -static void swap_writepage_bdev_async(struct page *page, +static void swap_writepage_bdev_async(struct folio *folio, struct writeback_control *wbc, struct swap_info_struct *sis) { struct bio *bio; - struct folio *folio = page_folio(page); bio = bio_alloc(sis->bdev, 1, REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc), GFP_NOIO); - bio->bi_iter.bi_sector = swap_page_sector(page); + bio->bi_iter.bi_sector = swap_page_sector(&folio->page); bio->bi_end_io = end_swap_bio_write; - __bio_add_page(bio, page, thp_size(page), 0); + bio_add_folio_nofail(bio, folio, folio_size(folio), 0); bio_associate_blkg_from_page(bio, folio); count_swpout_vm_event(folio); @@ -382,7 +381,7 @@ void __swap_writepage(struct folio *folio, struct writeback_control *wbc) else if (sis->flags & SWP_SYNCHRONOUS_IO) swap_writepage_bdev_sync(folio, wbc, sis); else - swap_writepage_bdev_async(&folio->page, wbc, sis); + swap_writepage_bdev_async(folio, wbc, sis); } void swap_write_unplug(struct swap_iocb *sio)