From patchwork Fri Jul 21 03:44:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13321299 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93FA8EB64DD for ; Fri, 21 Jul 2023 03:45:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 96EB528018E; Thu, 20 Jul 2023 23:45:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8D0F728018D; Thu, 20 Jul 2023 23:45:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74B4A28018E; Thu, 20 Jul 2023 23:45:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 670A628018D for ; Thu, 20 Jul 2023 23:45:20 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 43D83B078E for ; Fri, 21 Jul 2023 03:45:20 +0000 (UTC) X-FDA: 81034228800.15.11653EB Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf27.hostedemail.com (Postfix) with ESMTP id 0CC1940013 for ; Fri, 21 Jul 2023 03:45:17 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689911118; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VoMOxTnnrTWZ8rs4+m1BH19jtkngfSRXW7ZSyIZxahg=; b=7Frb/rlLmHWVDTAIJkX5/bvfQm5Ce/srp1lnBNNqRK0+gf0FJCmoRpMsNosq/zpd+oJjys gqIb3EG8xLAo0ANWMI0SY+L39XlXwXutCC6/4EDrwSBn1WiBNDAV6S3NaSMhj4hZcol9rC 2q7HgpGi3eWXA9b4yZutsiXoticIE2w= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689911118; a=rsa-sha256; cv=none; b=TkQeodAaQubuAaL90X5VLe1MVO6fXCWK8i2VCqzraoKp/jqFMs3DXO+TXcpI7otsflbBwP kQGS+Sui6s0Qgvzf1J/wIO5qCCpE4tbqet0JgkVTVK9Gbu/Fl3kocSLuVPu40OkqxAzOmJ UKI9uEwtfPF0kOEoLoKKwJGmnFmYtAw= 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 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-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 0CC1940013 X-Stat-Signature: ikdybyuehg5f4a4g7zyx6b59tpyc4f77 X-HE-Tag: 1689911117-855658 X-HE-Meta: U2FsdGVkX19SzZDN5vcdUGQqikRSDHomx2XoZ+hsAXjZPSSQ15yyc6KeiF/cVYvrTiKukHWgIvg86vZKEXbORWf/LRx99J5/dgN03Teddedpwab5T5Jo1zJdRix1qz+YeeMRB7r+Vd2cfEOifjYZj4LjLNoibmm3YEzd7+FUHwbwGDxjKOd0AiTERml3pv6cfWLYkeqqODkBlaY4Pvs3ztpjTca2cvCQudcJwd+UCEWhFUaojv3Ixn8FCeQFQCCHj7r5OG1LDoAvIPoGTwTY49MIdUJpQZSmx3FO0vx2CMe4ELy8sPerk4q72KJ+87mOyGg8Pk/I1sFcQtB/27pK5J+raY+BreAxdJi1wpctS5l+1+dOIy80h/D1mmm7DQpTyihEbvIhe+YoFvsDHjuZyu3jJDOEUfDsC9D5a9IPQH7iip08885xHQPP/3RQJ/Q/4WcHC0JpnDVatsEm+r2lgA26Rolv0wn1Bn8CtlZ9oQr0xtl6LCyqJUBvwsgXvhBo3jKxLYDgObWPyAOE4WaF72p0npRWx7xaftaV3paESEti1au1A75vxTQABUIIkDRfOYIRkIxLV9eUFZZY9mBPul3Z3o1j2Lbl8ycvXgNeSPyZy6XwO2If4HZipNivZlUKVWMOq6wkvs/+17CDukqljUhDgOD4i3cG2csZJvtKKfSA7Z5RjFMe1dvrW4mm6yKyDswo+/M71SKh7odumr7PTWu+JqOsrTSvFWxc7HAZ+/l4FDwoa77P0Vm6xNqbEtD3QQ67vc3TrDHULQboh4ibGOK+tW2KX1MpMvrhxIC6FRWpMeaC7gfKKZlvYEs35lOHQOfMvkcqgo6C/tHiKX3EUTv4e0s6lWxFCIlc2ykgbjpTT5uR0T4QGtHBKiCFNCY4ysSecwVe059+uBOP08d1i0uf1Rj/k268TucMKHOJqkRTRw3LfUVH5mljdoeDlipYytV1GFLzx7sJ1DffkyM m+bZTMP3 czBJSZipSNhocRpXEaxy087fV1u/gD8sByVpqLqOBLGcSI48RVEPphHJ5j7x9Ap+iEHUET4H2QMllgPrTMdOo4Gxv6KHbeWVmKGu4vFhh8+CWZDYsZWWFftROdDXurgsbIGqTqPbUJw1Qv5VHfKjjxh9DPhzqMMZ5Sr2gmXZtTQPQgPWAc/hl5nPNxNv3pIqCpy8FO+PtIykka1kBMrbrtQsFThncrAzHu16YbVSSqHYo04pL0vhl5dTorQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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); }