Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10426779rwp; Thu, 20 Jul 2023 21:55:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlFj+bxyUTQkfPRFP0Mz1X3Q/c1B1dKPUucarH6FW4apS/8tN8BA8Y63kgVLLdF1SQRbS/dC X-Received: by 2002:a0d:d4c1:0:b0:577:d2c:f7cb with SMTP id w184-20020a0dd4c1000000b005770d2cf7cbmr1016896ywd.49.1689915327112; Thu, 20 Jul 2023 21:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689915327; cv=none; d=google.com; s=arc-20160816; b=S3iBujGAd3qgeXsLGJ0f9rLE1yi1Hwy/ItpEhZ0eQlQ2hYPhNobiRP7PCIMrF/yYY/ INslhA0z2P/DdXZ5NEox87nlJ92fAjpwfPOizuN6e1+WnKaEjdAiPCbw85iIgqnoRAkA 63eTDcpjCsm1qUR4z+4czFOIJwbAOu7cN5UMRApCZPAgOio8VzqYb/jQHoU4+X29i8Th zd+4LqYVE0qISHpYorLxqEG8HYaw6hRINQAz775rXvZcFGjb+3cRGxItOvpRcqAERJG8 qycmBAsHskCwkSvArZYQrb/WJgvQUGz2yaxxgrYOo5943yx2drMiArifs7H1AI1ofKl0 dZAg== 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; bh=yLRa2ewWzPH1vKlLihFR0E4jRNz9kx/0dw9KKzLjX+E=; fh=q8rOnvZaN5Z50YvgZS1uBArX5ZcEEwPcusRFazgmNUQ=; b=BFFl8P0cMNJhGO9NfhszdLf8Lf2oAMrQfB90HH9zw0tgb8usuECJUzBIWNcGGnf1XE mWdQh8yRRqkmfwN5s2AtcpeyWOd9q9nFccK3E4l5ojhCkToT32Utv38O/JGo8/risQUi podHrFsKaTfLp4ZdhUezOoDPZJ+08cyoNNQlFx012ur2L5o8uOfXPRnddzWiPky+8JrC CoWg2rdR3lAZBC3TigKWxLBNwJn+lY3lnl3iJcf91md+1X1iJdvbDoM3tODIzy2TL7q3 qcinOqwTHXV1a+QS66JWPs0Jpq7EEHKCub9C52D3y+IuieyxXAI4Jrv+uBjloxKU8y93 Nmxw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a33-20020a631a21000000b0055bc22d13d7si2202781pga.692.2023.07.20.21.55.14; Thu, 20 Jul 2023 21:55:27 -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; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229552AbjGUDp3 (ORCPT + 99 others); Thu, 20 Jul 2023 23:45:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230072AbjGUDpP (ORCPT ); Thu, 20 Jul 2023 23:45:15 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12BBA1BFC for ; Thu, 20 Jul 2023 20:45:15 -0700 (PDT) Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R6b5l2VVVz18M5x; Fri, 21 Jul 2023 11:44:27 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 21 Jul 2023 11:45:12 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v4 07/10] mm/page_io: use a folio in swap_writepage_bdev_sync() Date: Fri, 21 Jul 2023 11:44:48 +0800 Message-ID: <20230721034451.16412-8-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230721034451.16412-1-zhangpeng362@huawei.com> References: <20230721034451.16412-1-zhangpeng362@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 From: ZhangPeng Saves one implicit call to compound_head(). Signed-off-by: ZhangPeng Reviewed-by: Matthew Wilcox (Oracle) --- mm/page_io.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 7e7a9f67b9ad..9df2a85e31b1 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -331,6 +331,7 @@ static void swap_writepage_bdev_sync(struct page *page, { 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)); @@ -340,8 +341,8 @@ static void swap_writepage_bdev_sync(struct page *page, bio_associate_blkg_from_page(&bio, page); count_swpout_vm_event(page); - set_page_writeback(page); - unlock_page(page); + folio_start_writeback(folio); + folio_unlock(folio); submit_bio_wait(&bio); __end_swap_bio_write(&bio); -- 2.25.1