Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7957793rwp; Wed, 19 Jul 2023 03:05:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlEyyDA4blIfcJLTYabEIXUgFxQ3/KYbJURc/2fx3JbEeeUGBDfkEuhfJ4CBryAEg/BC1y10 X-Received: by 2002:a17:902:7893:b0:1b8:76fc:5bf6 with SMTP id q19-20020a170902789300b001b876fc5bf6mr14984139pll.43.1689761130141; Wed, 19 Jul 2023 03:05:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689761130; cv=none; d=google.com; s=arc-20160816; b=CS8wAI4AwuOX3jGrms78q9P9oyJ5oDfwZ4RSD11qAb5vLiObWAfnRkwWWsJA3vhOeZ 8QA3o6sB/+cJy3R/UDfVHg2GgjgqQuaCgO2XW1nRQAKK+VHfAHU2durL2d6jHVH21XDv 9toXDAnN+eleDkznBKiAJLY6EVnT+yOLzvVfTkhqlk0wvXXFK64MjoNmm8PxPm9gZ1wh NIqHog3fym0nfYebKefMhPL0CGn+tSS2wrQUj2EAoHGXy4K4vUeNoPKDbk13BF/vaEZm Xqss1poF8auuS4nJCbzAE6Ed5vEQu77RotnCKj1eTs5JwviMUrpNghoYKgqQmAtCExVN vXEw== 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=05tbuRnTFRinPzP93Bz+bXGAm8DHGnIQ7HSd5f8g8RQ=; fh=fQ8bSAglEIUMWaW8g2fbwjC8kqQICqHTc4sMCYJe224=; b=XUVQpTk/gDm1RrEINk+3YhJgzi1fYLlvksPDGIQ2QbqQRGpMvlMrmgr8xapMbqn5RZ /b9oW7zVtxUvJHm/u5NR1FO7U7076jbcXvbx3cN2dAMdQbVm024yFuW4mmXKjPXt5jkO KadAve2MaYbKcP3gz/6kAwLbAoOilLSnsMJwa02IjMx7fnhiC74FlcoTwgGlKye8C6IZ Q1dMS/n0+3UT82sQiC5A5IDYOpVCZuFQI3DlR/x04cMGwgx+obcxkelwXaLLPhNOiYtX YNcCq7yZQOzW3nLmldUzLQ9jQNL5I/MR32s31z4wJY81erV3YGtyd7kv1SmGkm/aGu78 ahBw== 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 b2-20020a17090a6e0200b002634cad1d64si1136772pjk.75.2023.07.19.03.05.18; Wed, 19 Jul 2023 03:05:30 -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 S230447AbjGSJ7i (ORCPT + 99 others); Wed, 19 Jul 2023 05:59:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230320AbjGSJ7B (ORCPT ); Wed, 19 Jul 2023 05:59:01 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F2D41BFD for ; Wed, 19 Jul 2023 02:59:00 -0700 (PDT) Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R5WRy72ngzLnsB; Wed, 19 Jul 2023 17:56:30 +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; Wed, 19 Jul 2023 17:58:57 +0800 From: Peng Zhang To: , , CC: , , , , ZhangPeng Subject: [PATCH v2 6/9] mm/page_io: use a folio in swap_writepage_bdev_sync() Date: Wed, 19 Jul 2023 17:58:45 +0800 Message-ID: <20230719095848.3422629-7-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230719095848.3422629-1-zhangpeng362@huawei.com> References: <20230719095848.3422629-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: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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 92f21f380ee8..0c96ea9dd258 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