From patchwork Wed Dec 13 21:58:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491928 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 E8BF8C4332F for ; Wed, 13 Dec 2023 21:59:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B422F6B02C5; Wed, 13 Dec 2023 16:58:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AC87B8D0064; Wed, 13 Dec 2023 16:58:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 969708D0062; Wed, 13 Dec 2023 16:58:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 83F9C6B02C5 for ; Wed, 13 Dec 2023 16:58:59 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5747214035B for ; Wed, 13 Dec 2023 21:58:59 +0000 (UTC) X-FDA: 81563160798.15.BAFCFE8 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf28.hostedemail.com (Postfix) with ESMTP id BAA46C0002 for ; Wed, 13 Dec 2023 21:58:57 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ezDJ6yqY; spf=none (imf28.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504737; a=rsa-sha256; cv=none; b=hVlylfXeV35uaSoJfifAYt6tTCfaPWJdK9nM4+B8mOSlVfz2IZTV9ydJZ8CN9ucbq7sSLF CJWt1qr1x+KpCtxkwP1+PD0sNwX+XmsraRIzyPCjVWNHPYGTuhd9X+r0F9zFiPiTIm1tXZ fPCUxLDE/rmX3DA0+5uuzYYDiMrA0FI= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ezDJ6yqY; spf=none (imf28.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=1702504737; 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=RJGtC0xdK9xK8HUrQwoSAWCOkwlAWan2MRWph0zUvZg=; b=ppk7vfHv4tPTXVGE2PYm+vTTk2axujlVuc/3W/Gy/yUbt2nIzrPFCv7HyOnQb5rvv/3WJk eaqNHQ6SL2n353FeADr9Z9qJRqfWO3M8QLY4pnWWyKcdSsyF06al5v8IZ82ENEdrFS+Q/9 Wts++TmHRb8jglUBlftPFUD8aW6dk9E= 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=RJGtC0xdK9xK8HUrQwoSAWCOkwlAWan2MRWph0zUvZg=; b=ezDJ6yqYdSQMDQxjZUPB4Xj90s StYt03woRe6Evt4qZb2PNgn6GeOMHkFbm0TWEGBdHScljG2FfX9H9xceaOMnw/AWR++mSu+4M4J7T dnDrpOmKYFL/N5/DJWGMCBd0bEBEfUQMrFMl0MinW//6rWt9QuDK/5Gb4VbJietRtSdcF03s3q36f +PDREiRxqQ8UJNVIyWaQfZV+ycmAuvjPkaNjCewcijqfNQFED11jl0isUKeQt44HlUhCCmtS2G7ge cWTsae4vKHkjMwkYpUJvBqiszsd0FzPfsIOOWr7TH9xYG8vD3G+b9uiLJFiPt6i1zGqxuh64OQPTy nnZHTqqA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFd-002oiP-FN; 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 04/13] mm: Pass a folio to swap_writepage_bdev_sync() Date: Wed, 13 Dec 2023 21:58:33 +0000 Message-Id: <20231213215842.671461-5-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: rspam08 X-Rspamd-Queue-Id: BAA46C0002 X-Stat-Signature: szasmx7zpd1byi4zb11wbgcs8kyqcrm3 X-Rspam-User: X-HE-Tag: 1702504737-271097 X-HE-Meta: U2FsdGVkX18ATaMJdV2Pj8LaGp2SUVUSdJ1aSl0V6uEqO4Pba7Y/G2gxRcjm3SRf5mYJIMGWCUxiLuwV/PqVkoXToujs7YjEbxtccBOsLcWd3OEflwJTl+7wdHXgwIO1tlz01aSYMPCqbDJHAFByI0ZR6vEfax6vcB22N18cpnrLcvH+x5CJp/WtY877PdUGQChxAgw5v7zQx20MwYX01AlQAMjmm3o8f2n/hYVPk4gtuEmduRl/h4elb/XoJjE+nsqqcyn4FqcnzBGeczqvlUZPjFZUdREbuiDxY5UUN/8wqRN8A/Leiqstk2NII8mgjuvj8NdNon7dfBCXRdf43gN21sw5JaUTBeTUbJ3GFWwpaFQvaKS7RaY7ljHCP5NUf1bM4y12oIKV/QBqWIZFehlq3+0/5mM6BvSFXIeCZY9COKM+E4lKWQ9TjiGjaM3Zj1ZmNJIcWxJtz9QvjFJC+fcxZnxFzZuhPPPW9GasPDNg4s7Uj175uUGgr5gh3YTnEyA6KpfnoPOMSbG6dcWM89bE1tlKe0E1QJbzDA88nNuAuNIINkzcOaWvKezbyKjbTkphTfltQbrVKrn3jp8NhO/nHilRhS9d7bgDBYD2EVB+H/73HbyAcEdCa/xg7Q1WBbtDKDKgjJJSycIwEaraY5wlHlW7MHe1dpfuSYJg7GvnOB8CFePD0iZQm9k+N9zERZFfpOVzMqgcsCt+9Wb4NZ/k4s5Ac2qouGv4oBlsLiUBD63AOPXqdaN1RiqUvKm7dMfBCnvqzZhr4bvbo3P6tr8jqWvfjmfrQBR89AuXIcGnAMv5mLpQpkOY0WghoaomGwuhKLkAP84Ko2rb8lWLa4bn/Ew+qRv2Xtieq3Yfm0IwK9WidvqOhGg1Wbtms7xQ3UVG9DD98sb04FgadodC9e09GdFTn4Iqugw5a6m4Ws669p06IHoYzs7oe6oE7oVUTKsyUt9BjsAK6Y9FFUa tjU5XMVC fzJmLOvUOjWp89Lbc5Qe9gG+R+febhNG7OjqMQsSYHtWtS2UoYDLcxZWlo907llLUkePLVXYGuUwyv7kvvtgFxdAUCEDX0XJRQv4ZB9mZ10+Ja3tqLnl8FS5tpfrmlOD13RSupHPCdy10Sa/8bTDGfKrJe/vj0SU4/sKGnGMwwybzya51ZRCdgRsGJidU4g/bZtkz5vswPW9BXOp2pJJ/q3eHfunOdELRl3cc 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 7f67d8e2ed9a..1f57e26fa282 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -326,17 +326,16 @@ static void swap_writepage_fs(struct folio *folio, struct writeback_control *wbc *wbc->swap_plug = sio; } -static void swap_writepage_bdev_sync(struct page *page, +static void swap_writepage_bdev_sync(struct folio *folio, struct writeback_control *wbc, struct swap_info_struct *sis) { struct bio_vec bv; struct bio bio; - struct folio *folio = page_folio(page); bio_init(&bio, sis->bdev, &bv, 1, REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc)); - bio.bi_iter.bi_sector = swap_page_sector(page); - __bio_add_page(&bio, page, thp_size(page), 0); + bio.bi_iter.bi_sector = swap_page_sector(&folio->page); + bio_add_folio_nofail(&bio, folio, folio_size(folio), 0); bio_associate_blkg_from_page(&bio, folio); count_swpout_vm_event(folio); @@ -381,7 +380,7 @@ void __swap_writepage(struct folio *folio, struct writeback_control *wbc) if (data_race(sis->flags & SWP_FS_OPS)) swap_writepage_fs(folio, wbc); else if (sis->flags & SWP_SYNCHRONOUS_IO) - swap_writepage_bdev_sync(&folio->page, wbc, sis); + swap_writepage_bdev_sync(folio, wbc, sis); else swap_writepage_bdev_async(&folio->page, wbc, sis); }