From patchwork Sat Jul 15 04:23:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 120754 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp25716vqt; Fri, 14 Jul 2023 22:26:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlGGMbitP5qVZKKNFgrkCFv9QaslaksRHCUX1j7/Cw61XZob2eMCKse9fK6vgxcR5xgr0RMm X-Received: by 2002:a17:90a:9b0a:b0:253:340d:77d8 with SMTP id f10-20020a17090a9b0a00b00253340d77d8mr5834729pjp.33.1689398781219; Fri, 14 Jul 2023 22:26:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689398781; cv=none; d=google.com; s=arc-20160816; b=vYU5AGqqtehGdQCKqkipnYw2fiweKFhYH2R3tTvBDdAL7M/NaiFQ4j7yX15m6s1ktW eMe97CYDIPPKbuoZGqJonXdP2I/Rvkm4q3MbR45iXtB7PTanNA2SGFhmITjm6nS+soe4 c4AkySNWQtvbBP3OliGrN7C5KfPx1iiLSsd2DI44zlaAbU0mWPu/HvTJyKbDXFVmvgwG 2qmWXQOlFW9brExEfooMQlNaLelH0Jz6gVGQ5tuawdszVNBr2TMgzbmO7SmdndC12uLN 5U9kq3VHx0Emtz/6wdYMtFDz1DghmulEvhbYueITZ39HhZyfwkYUatmg//E0iwMdZcV5 GuYw== 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=EduZ7W0Le6I35LYB/u+YcVvsoSvotZ94k7H+d8Z5G54=; fh=r3T7dnr8wArqVbCWzme6SvP83Lr9YOebNJZ0TnSVZks=; b=irqnNGROiNG32ySu6gFVIfSzR6on2HT5sOey9LSqSZ6GvICH734+XpJLHR0tpCN8Ro MAV1MACWk2Ovv8iaTPyFumcCvovPKrfKrRu9D5NddKVEl1MUS6xuiKLVeW3FrwDVBOAW TdwuWZcm4rTA0OwylRrML5OKoj/0BntkK/jKSQkCiaWZ+CG+zA62EiTjiXG+Th2Tif6D C/zxSJb1NgIL3g0bxvPwOD+BQ+T1Xgo/Ggqnl44+yCglGksruy22q2yvkSisFksXR0EY EDK4qLE4MQcn4Uh/vDccKL3dwfkE38xIdAOUzW3s3ykpmzoSGQv5ICPsaZEbmoqaDLMz WDHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=MLPY15+3; 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 v24-20020a17090a899800b0026383536294si2301121pjn.175.2023.07.14.22.26.07; Fri, 14 Jul 2023 22:26:21 -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=MLPY15+3; 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 S230473AbjGOEYW (ORCPT + 99 others); Sat, 15 Jul 2023 00:24:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230389AbjGOEYP (ORCPT ); Sat, 15 Jul 2023 00:24:15 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A42B13AB7 for ; Fri, 14 Jul 2023 21:24:06 -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=EduZ7W0Le6I35LYB/u+YcVvsoSvotZ94k7H+d8Z5G54=; b=MLPY15+33nuOpVVoVVRORpp6nI B/2U1S0zN4gQDRRyF+TgPm/ye6qNmKTmUuBjdlI85g70rDYYLl3wpIXeJ1w8A6iUGsGwLcd3iWRjT zInEVcnDaflgUwfAOt/su4CbibIVXpgzO+dj/HHhsqU1P3IIRaW4P7dsE4QKSsLqO6Z5mcMFmSFvO ljBj8CiLgN1MYIu3xDFDnuCRCFSotXCiHiKZsatJ85Ev1IcZf4YTiuuksfEXUC7qPbieXKqY3JRqV N/UzhHm4NXg1D/1kAewieLPSG58JipVtcLTXMn6Psdx4SAvEQjzsGCe55itdzotsD6bmw9e4fXlCG 7rMY+5zw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qKWos-001p3o-B3; 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 1/5] fix-frontswap Date: Sat, 15 Jul 2023 05:23:39 +0100 Message-Id: <20230715042343.434588-2-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: 1771463016610808584 X-GMAIL-MSGID: 1771463016610808584 --- mm/zswap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/zswap.c b/mm/zswap.c index 1b0128060792..f6a78e085479 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include 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)) {