From patchwork Fri Jul 21 03:44:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13321298 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 CDE8DC001DE for ; Fri, 21 Jul 2023 03:45:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6FE1E28018C; Thu, 20 Jul 2023 23:45:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 54F4528018E; Thu, 20 Jul 2023 23:45:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F5DF28018D; Thu, 20 Jul 2023 23:45:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E04B928018E for ; Thu, 20 Jul 2023 23:45:18 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B7B2216012B for ; Fri, 21 Jul 2023 03:45:18 +0000 (UTC) X-FDA: 81034228716.19.9B877B3 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf09.hostedemail.com (Postfix) with ESMTP id 8CE8A140006 for ; Fri, 21 Jul 2023 03:45:16 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf09.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=1689911117; 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=yLRa2ewWzPH1vKlLihFR0E4jRNz9kx/0dw9KKzLjX+E=; b=bcF294O4p6XhEZYCOzgDR/QGA4neBMn1mc3E1eZUhvQQUQtElqPfCbgM8+02Z+nHfiOZeA KnHqGCrEqCOTAXVy7egGHJ8cXFmH+xfefeugAVHa1zJOOk3vlv9gLSiX5gq2d3nn7ceUCp eypHjp5GDDq+W1rPAcUY1jwCDOwP2OY= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf09.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=1689911117; a=rsa-sha256; cv=none; b=WsVe1XToJTyao6Oznzmh4y4GkE6x7gkuHy3z24sfUKnUrWmwrtYjKlvAC6+EA1DReuLTEu g+U/vFjXx4qvGoM3w0ZwkMbJdKIef1VFG5SXidg91fukUiLF6hpOWQFtJY0XRWAzwg9Ll3 urajVN6J191sLmc4lRAmLlZV1bJkm8c= 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 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: 8CE8A140006 X-Stat-Signature: 7qyxrtct3ca6t78yz9ixuewzs8tzwad5 X-HE-Tag: 1689911116-772252 X-HE-Meta: U2FsdGVkX1815ZEOcOpG8p79Y0a5zJJLROUfRSRFN0kHrXd9whHAjTOt6ChvSgEqFuVVVnD8Ver8cn52Cj7iIM1b68htvjKsOHN42hrQvuH8JX9xMR5BUUMFyepPDvMMyPi8u0j+4WnnsYVcTa2LDJ7nuwCJDNjrKL7QXqcGCFNEq4xBYtCgzyk9yTSqOOlFYi/dXJ1FgMKfz30czZpw+DFmTgc/7D/DsrpzxMz6z82rZE6V4EqPSAWSLi+e+fdmJ8dTLBL3O/nigXPBGvCpPoFjiNtD9mV5qDxjZErgwVwd5QuPi+04u6LPAlQrsi47KmKQ4ANruLypLDmuUH5zLTrndZalTgnyqKJCF6w0+PinytwOVuCdRNjRDoZJgD2GXZr8b76TsHFVNdkVwMXImKAZHdu2YJAx44Skix6ZKlarJnYFBk2UIAGA6RUA05GlpOLEBU3V0V0/lGN4qNEpGur5BUok8fGAQY+jWMon/2sbhh8oB0/Zk4Rh0V1lvyjIvuVnYSn8vUtlNi2lMZq9X1OLnpQA7vLAGYbHHDRjS5CSZwqfP7fYUMeyfl0sPpWzE+dn9/hY4nHj1oPGldJuP3ClhB11ZB2oTfjcO4Y/P4ynvcoOC0mAODCsuTEndqkpVhUeBzJKoGkark77LtkaP4SARbD7MZfkTK9p1maYiMMADwwPVVtTDSpGt4UvYcud9awvAmzYazzyDzWLSK2h0SYUZqTvnIhmW9j4qZja0LjdxjjSODvD5orwWrlc/zIywrKAfXS/9JYuwNyNd+A9tLJjINWU2fibt8hv69XSuLsIvNrPjUFVjrfp1bvaDfLQHj4N1TnFdNwAnYrfX/Sk42GvnBjOFhNWRLRuxAwdKjuiYVkVvOnvnmIa44w9M2ZYXowPchaS0grOjDzql0EoY4b+Bo5/QLdI6p9xliJSzh/CxuL4CgmJZom/zbKRB1DxKgQRuyvUEyt12c9EtdB mnV/HeF4 2RQB1mBUo79eqe6Zsgr7SSpeKnVyNCghc7/YySTI8UlXN+PFReRfZlj9Qm5wnGiODfDvaRpXhUtbjTP+b1qQDV7EVlJHWNnZAIzpjyzWWp9mqwTxjoXvpsOECbrGY9ZgU/TucIG1a7U8Un/JDJNGvi4G/bWquemm9delhZA+TbDaglIye7GuuqJKPqYEFpLhX2Vt9UPvQuYLRw5vYaahZOdfwUFH/9XaEyabQCEopWrxKH0o7fmi1wMJDuw== 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 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);