Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10402735rwp; Thu, 20 Jul 2023 21:19:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlE9TFnFu6AEyaIjdIhton+sx1hKOHzXiMemK/UuOWeYN1/inv5hcBOU+tOWnjjJEXLkJLIW X-Received: by 2002:aa7:d1d1:0:b0:51e:45b8:b0bb with SMTP id g17-20020aa7d1d1000000b0051e45b8b0bbmr632615edp.22.1689913154497; Thu, 20 Jul 2023 21:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689913154; cv=none; d=google.com; s=arc-20160816; b=yanJAO4tH3VmpYh2VLiDPFB0Tes6c3GZ6aJ28kPMwRQzwjubagjipVRgTcf35ohQKP qK9oujAw2L/l/hlekW+UM5042pRHi2ciesJ5OP/jgqUiMSevAk2pmCKxM4xAMmqFm9av zi46SSuysuZTHxQp26UNwWZ2+5MG1xvVnvqkxt4MQwFngjmMwT2RKnQ5W/WR2a2lVJYN kiIk3FA+vxO2wqwOq5mbgP+aNpHJJwaPV1jDNW9QiVeHYmByUV6VN7eao4vjRljxoWrY s2/mX8JL+vQxzoQOCWY50IPlVqMNGTmA4K161OJtc3c0v+FgdF+MZH/XdJVawJaXdKRd SR+w== 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=VoMOxTnnrTWZ8rs4+m1BH19jtkngfSRXW7ZSyIZxahg=; fh=q8rOnvZaN5Z50YvgZS1uBArX5ZcEEwPcusRFazgmNUQ=; b=WgpTMyRgkjgAMNt33zcxOJ3EDrC+WFNYNebvmQ+k1iGwQg4VZm2wjIrUJQ+flmvmZu BSw6w7AHnVDTXvkCMkAQ+JyaTo8HLAz9fBGrozjNU062OEorlSxTZMsUNn4QedKQbQVT 1tQXYJkVhzMcJbTBc6zDBOeSx7K0joGS/uIaIBH+BgSbACyWORLLIPVjbkL3e0lw954J a1O7zyCk7x6ASUZZWLlBnA0qQF8YBjeeedTmgo+zH+9n+2D5JIOj7hR8kaf4NYoXOy7Q vZV43gnRXFZ625WZNWpMiXMyahPtZBvzfuLi8JujA3l4+E8VSZW8Tc0b1CkuBZwWOvol EqNg== 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 p16-20020aa7d310000000b0051e24863dd2si1794610edq.377.2023.07.20.21.18.50; Thu, 20 Jul 2023 21:19:14 -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 S230173AbjGUDpj (ORCPT + 99 others); Thu, 20 Jul 2023 23:45:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229797AbjGUDpR (ORCPT ); Thu, 20 Jul 2023 23:45:17 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C675C2729 for ; Thu, 20 Jul 2023 20:45:15 -0700 (PDT) Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R6b5m0YNWz18MB5; Fri, 21 Jul 2023 11:44:28 +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:13 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v4 08/10] mm/page_io: use a folio in swap_writepage_bdev_async() Date: Fri, 21 Jul 2023 11:44:49 +0800 Message-ID: <20230721034451.16412-9-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 9df2a85e31b1..07bad3a4b701 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -352,6 +352,7 @@ static void swap_writepage_bdev_async(struct page *page, struct writeback_control *wbc, struct swap_info_struct *sis) { struct bio *bio; + struct folio *folio = page_folio(page); bio = bio_alloc(sis->bdev, 1, REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc), @@ -362,8 +363,8 @@ static void swap_writepage_bdev_async(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(bio); } -- 2.25.1