From patchwork Mon Jul 17 13:26:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13315704 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 E0064C001DF for ; Mon, 17 Jul 2023 13:26:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A4AE48D0003; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9FA5C8D0002; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5DDBF6B0072; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 3CBC68D0001 for ; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id EFBF1802EB for ; Mon, 17 Jul 2023 13:26:17 +0000 (UTC) X-FDA: 81021177594.27.AF1609A Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf15.hostedemail.com (Postfix) with ESMTP id 1DFBBA0013 for ; Mon, 17 Jul 2023 13:26:14 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689600376; a=rsa-sha256; cv=none; b=MaWxDW8ClyYY7XpAPMK04nw9M/+i1EzaDtvQkzB8OGLasOLQizW/F/Rs3ISpl+lScwhMoO KJtMMGKChuGxfrCbYhX9didHd64oGJCmS9PUBqwV6Y4VTEtRI95UJfkiOowZsa9ox/9U3h M8ZEB6bjZK+hbwdP425qQM9uEhDvNOU= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689600376; 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=z1m3qTju++wCcczvOgKEj14bvT/wRWlf9L7jQUe5zb0=; b=dzPUP8RzxxYnNMjthcXehvQvHOCKY/QLfkiglg62jQghD7vJgxUzZ4X3+vPisvvcBoS0ug o5Mo5ShQJM5eRQHcmxX7pnSFjLuI/j1x1PYjr8wvCzbixqNDa6JQavU1STZDyi1JkMpuJK EWLo/SaZ9FYyKmJIKk7nSjwb6G/Qfsw= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R4NB16bzXzrRlh; Mon, 17 Jul 2023 21:25:29 +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; Mon, 17 Jul 2023 21:26:11 +0800 From: Peng Zhang To: , CC: , , , , , ZhangPeng Subject: [PATCH 4/6] mm/page_io: use a folio in swap_writepage_bdev_async() Date: Mon, 17 Jul 2023 21:26:00 +0800 Message-ID: <20230717132602.2202147-5-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230717132602.2202147-1-zhangpeng362@huawei.com> References: <20230717132602.2202147-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 1DFBBA0013 X-Stat-Signature: duthej7muu6po4k4qxmo9q5uh11c5dta X-HE-Tag: 1689600374-682978 X-HE-Meta: U2FsdGVkX18p6D4gzahGYPPF7QrPz1TsRTLon7Z4PK41Tfnz88mQERKzS7H9YkBN2P7kWkck4VNw4NFmgQqQ27Tk06Phqockg7TvCNRg4emdKdDafpOxZGFI4rmbazsLabizBczH1PgrZ46PxKFROQR3L66r3DCFNHAJc/5qkWyLIOnw2Osu6ehEjeoahIzBMXeXLOaXGRpO5uD/cP7XvXStV8Swu3rDyhplySRBVXZFpM/Pm3SjfKDxUtWJpQCEE/ZtgeLsqct7FFUpvCBW8jmjhyIOXh8fiHUFhjW+sca+SAAgdmToSnlynZzVB3AyqywkgHvUM9uGvT5rMnlL6qhO5DdudDcEli24k4sWu1tkOO/C9p87bTLyj2uDE2grA1/YfybSmBh0ev4WcYbpjfD+llyriqGK84tJiGg0NeLY0B1Xp5X1E00f0h+mNcM0P3ZQiNDNh/jJUyeknwktZkOYDtZLdt8gf3gSxOW4PT9UJc8/qFtCjGQ4obX1Lc/Axx9bXoQqoH2W2ZxpIGoJYUe/3WZDO0oYhilhBD4CREPgyMk6qAjDgwf5FZERBoRYVOoCfzqIuWvyDI0OumD+IADYuw/N6Y1wuwbva58KKIGkVbhADPj4nF3fX1u/FctipQRBa3qxg6vBT2oAoKdg1EsG9Q8nqXY0oSJunfe+yy3eTetkf5JcPDEB/DlA0h64DZ7MNGnQgjdsVujRv4fuRAfn4DYqtRpVEB9QhGqs9a0bTBwOIFQxb2RR+Md/K6QXhXa0f+cWNvx1gT3ZafSB25olcm7e8/RR5OAEsNlWq4W7Rjp/mAU4RMmJY/v0+gwfAbFCKxg/TBZDsDf3oTtxDUSfSBR1Hus0QhulZvP04x1dUTJ7mDNQdTAkRKv+hMdr/vdH+E9JUX3RnMIoizhf9UzvO1MR5IICWzfBiGOpRJ9lpe0LytTRvDfU5AFKASV64sBAViODL170RMNUv+b ThOrLHvN T/stT6/Auw0ZlQWf6XddjwSHT6/wRA5AwRV5IMiZlIw5MSCCrPeppy8wlD4ZYcA2K8dj3/N1njSqcQX1mY+AHThv9FRRdVpOL128ny89ebF8Z/2R5NX3mrZL05GUPKcSsahB6ZCfyjytb9dKPyAUVSeKcF0RVdrRxiKNdWouvz9xFjMUHXdsLN634XWqmrz6nH5Gp 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 f24f814b8dca..84cc9e652451 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -355,6 +355,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), @@ -365,8 +366,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); }