From patchwork Sat Jul 15 04:23:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13314375 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 13C29C001B0 for ; Sat, 15 Jul 2023 04:23:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8BB556B0074; Sat, 15 Jul 2023 00:23:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 86B866B0075; Sat, 15 Jul 2023 00:23:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 733A96B0078; Sat, 15 Jul 2023 00:23:58 -0400 (EDT) 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 63D316B0074 for ; Sat, 15 Jul 2023 00:23:58 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 273C2400FE for ; Sat, 15 Jul 2023 04:23:58 +0000 (UTC) X-FDA: 81012553356.11.FCAB62E Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf07.hostedemail.com (Postfix) with ESMTP id 8D4B540014 for ; Sat, 15 Jul 2023 04:23:56 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=jimt36fM; spf=none (imf07.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=1689395036; a=rsa-sha256; cv=none; b=oF97dS5srrO2Q4ZAHHfY0QnP2yF0LUesJ7W4lbnMn/iXNW3BNuUC97wI7mzb/3xFOesMB8 +fa/CXpbGeRI/We/R9GIRTXP4MaizVS86S8YG15pxkcxYssf/f5l7WwwoydxYvCN2iXXvI pt9Q9LyQvjvCyXq+HC0wjq6k73GlPRw= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=jimt36fM; spf=none (imf07.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=1689395036; 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=KykWwNFW2V5pOcZKvJr7OCs/yVc8LncYJ9HLsA6CPzQ=; b=QTZFY7fzHioZdNVXITPYmDei8GnWXh/OuM83iuCcF37lQZo/bqs0fGhzAS+KV9Bs36iByF xf1gFaWH61EXnRNTltxFOYbPN8u4tzDKYcKcTq1nMLiPUTtyHOjVINX4LZt37e27TXhXgE 2XALuEZk4XSksddk0YU98UJ2SWIHmUY= 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=KykWwNFW2V5pOcZKvJr7OCs/yVc8LncYJ9HLsA6CPzQ=; b=jimt36fM3V2iDkBnN5O5trWSrN FlJBU1FP9iOdaPzGGDEwRK0PQkIz+abiL64QteduGF4avMCfp/sqSib/NlWF1uIEUt/IO1EvMFhW8 AZN/J89Ziu1jEY6N+WGhB2NKc7yI/U1k5bkfFpGbGaVGHVnDBKuIkPggMndS8IJ0zV+meTRlIsyk6 Sb+YVmtMbBk7CEF9Bhl5ErBDCP8IB0fkHQ0wK7q9TxU+yKgtSHi4djyP5TITP9aaY3An8fbZja4tw GqP8YcETFt2VMwO64AwsUDCF9R+HhaJCX6t08E5D12BU9qrlv98oNS2nymFr0bWg8gX8NRenLOcir TC8VPDyQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qKWos-001p3u-Ii; Sat, 15 Jul 2023 04:23:46 +0000 From: "Matthew Wilcox (Oracle)" To: Johannes Weiner Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, vitaly.wool@konsulko.com, cerasuolodomenico@gmail.com, nphamcs@gmail.com, hch@infradead.org, yosryahmed@google.com, akpm@linux-foundation.org Subject: [PATCH 4/5] swap: Remove some calls to compound_head() in swap_readpage() Date: Sat, 15 Jul 2023 05:23:42 +0100 Message-Id: <20230715042343.434588-5-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230715042343.434588-1-willy@infradead.org> References: <20230714194610.828210-1-hannes@cmpxchg.org> <20230715042343.434588-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 8D4B540014 X-Stat-Signature: 4hq3t35ietd774b6pobba8i9icpz9igq X-Rspam-User: X-HE-Tag: 1689395036-79433 X-HE-Meta: U2FsdGVkX1/is1aNSWlOujU5l+CF1vurTVwmPhfaVJYmc/hd27ARwwv4QsIZGmS9ST0L/BU6Clrp2FSDsX27C0DPG5MdQb8Dg6T69kYrJPhiwL9CoLAfc8xCfRBOTbEr3UqedxN8rf5ZRQZXlqeVjN9WaW4glkm1klngCEiAGaUEK9fcFH46J2QxOZF6WY+xUjJOTAXs5v1sNEzJCmmDQcIYzSCCo6HSMEEHpXIA7YOdiTY5e7jVDtiVxYKpO6yVWL4PX/bCCMk41Ma5gRZSUpW7wpwTOl/iHUKBZUxUQqfWtPut31SRZZFiCJlGMaat5giYaMYVluPQ+vzQTkw/5d6bmXfvsPmewPpfHsp3WhN1LEqcw8ibauxeGF9lr1Vgt+D7SKkZQZbq2kXff736osD6FHtY68Gk0J5Uzzf//cBc4+A95xiUETCXnLj+7GVOr/BL7DDKwBiZFxrGZT5JC9QLv1qhve1HhA/cayihHQE3XhFto2NCG4pqRzCUoKas6I9hRgGZ62UswdHMzUKFz7h0xQRaiW0dJ/fvdmPNYcttvwihYl/QeefUo7YIV6hgys89BU4EkJC1adS6OHbvbMAN1x1nfBrEt3VYcoTBg6yqOi856vIPw/2XMqbD0AonSYdJ8EguXz+VFxXmkQzSSanYNmglOLE5WFtXHzUP05eSG44Llv3Y/rriYVlEBvRpRdtrCbYwgk4/xJ86LC/gwp6VotYer56kxktJZJOKUJ4ybFmeB9rNFe6eSTTyIQvQo7w0mlNf4iFpT6h8XD+pdwXTEECxuf+lShR2i5fOkugNYXJmaQ1S/sBs39/JCrZZOPK5RTEk9YFSncc1mRh9XNRXmZa9URuiinX79ju4CjiyHiHFUpQzdRSmseKiJpXpHetbl1lyd9Dm09gGb6zQNJGtwRHAUKPZCY3JVeb+M+LqAxT3t4U+G9wd2PyMgGoKiswW8rrDFsmHIbc6W+D P6XJGT58 /ELWMgt3ICn5uUDjBTp0sTYAxu1/1jE1IaJQMLZDKDbVUpdROJvcwaRw2o4vix7KtIofCzs38z0NJniUjDskCVAdFR4qZi+34J7nKfsRWqAXLeY4wSs++6oKDttTwhT194qddEvdeWcrg3Lj5k9x7KrfDcYXJtpzs/6axsM7CNPJqTVEObGJqU2fgzAW1RbsLzM3eIE5G3Ic0uHQ0NZdFjH9q0KdDWBznhvvQ 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: Replace six implicit calls to compound_head() with one call to page_folio(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/page_io.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index b9fda7fb4e75..e5b6f1402506 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -495,14 +495,15 @@ static void swap_readpage_bdev_async(struct page *page, void swap_readpage(struct page *page, bool synchronous, struct swap_iocb **plug) { + struct folio *folio = page_folio(page); struct swap_info_struct *sis = page_swap_info(page); - bool workingset = PageWorkingset(page); + bool workingset = folio_test_workingset(folio); unsigned long pflags; bool in_thrashing; - VM_BUG_ON_PAGE(!PageSwapCache(page) && !synchronous, page); - VM_BUG_ON_PAGE(!PageLocked(page), page); - VM_BUG_ON_PAGE(PageUptodate(page), page); + VM_BUG_ON_FOLIO(!folio_test_swapcache(folio) && !synchronous, folio); + VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); + VM_BUG_ON_FOLIO(folio_test_uptodate(folio), folio); /* * Count submission time as memory stall and delay. When the device @@ -516,8 +517,8 @@ void swap_readpage(struct page *page, bool synchronous, struct swap_iocb **plug) delayacct_swapin_start(); if (zswap_load(page)) { - SetPageUptodate(page); - unlock_page(page); + folio_mark_uptodate(folio); + folio_unlock(folio); } else if (data_race(sis->flags & SWP_FS_OPS)) { swap_readpage_fs(page, plug); } else if (synchronous || (sis->flags & SWP_SYNCHRONOUS_IO)) {