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: 120755 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp29246vqt; Fri, 14 Jul 2023 22:40:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlFf84K9xD27ZwRxh8o8OMxyghH3FnfB0xgU9sKtHfrjU4OuurFakyi2Sv/3rUhz+4p56XD9 X-Received: by 2002:a05:6a20:5482:b0:133:5eca:a8aa with SMTP id i2-20020a056a20548200b001335ecaa8aamr6872685pzk.46.1689399644487; Fri, 14 Jul 2023 22:40:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689399644; cv=none; d=google.com; s=arc-20160816; b=zZd4tB0YdpMesNT7+FClUZEgC87ke9HXVzNVjfLibgOYkGZ5IpzEQYbryO0QzXpUtX anuiW9EBtR8BduEh32bJraWKsO3p2vgnj4u9IXZjMaPrQtx7qnE0VReMiwy/+fL+ERjZ Y4sdj2e2dt7+x7gtCbYp5Rzp1mUiud4iI9f33jFH7Y86amEFleSTLGmkNqBNx/TVjiLK 9+mPaDx79kzzeuGc972iRjp011Up1Cc3DuF1v2Rx8n3gPm5r+0LeWbPylVzfsmIwAnCt l9Uyp2EIksFscf2g+voQSRfCNC3RHQvuud9zqIRQKiWsqj3EsvpR3ewCq+pq8fraGG5W VhGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KykWwNFW2V5pOcZKvJr7OCs/yVc8LncYJ9HLsA6CPzQ=; fh=r3T7dnr8wArqVbCWzme6SvP83Lr9YOebNJZ0TnSVZks=; b=pHHDcb+WLaNoyGY/JA7Do12yYUVF7JEsTDnj8j6FItIxJ0dqFaAeSgtqUJH0Uppr// YRGQmTf9dDLy1gmdCu/a8Hhxz++8gfxOW8fDA7NyN4UtAsL457SvInEZkcKrALGBmJse I3yGXDs9aO3nxYamqT7hQ+eWVCgfazDNVvpswx4rBqdMBkxjfTzaz+5YPt6g1jdK7BDi 9Us0niqHJXK6+DHcoPEuVj8nav9SdX/+2AyVk0YfMwqVLu9ERgb00x9SWptkIrV9HzAG 4xEoMUlks5D3COhDF8aToYL9YBjmj0cMVTmt60uh9r6ULimeo8lFVYaQo6eeUC9yamfR CZwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=jimt36fM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e4-20020a63ee04000000b00553c2f85088si7792498pgi.888.2023.07.14.22.40.26; Fri, 14 Jul 2023 22:40:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=jimt36fM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230371AbjGOEYD (ORCPT + 99 others); Sat, 15 Jul 2023 00:24:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230354AbjGOEX6 (ORCPT ); Sat, 15 Jul 2023 00:23:58 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12E4835A9 for ; Fri, 14 Jul 2023 21:23:57 -0700 (PDT) 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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771463921393383181 X-GMAIL-MSGID: 1771463921393383181 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)) {