From patchwork Mon Jul 17 13:25:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13315705 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 5957DC00528 for ; Mon, 17 Jul 2023 13:26:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CE6948D0002; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BFAE06B0072; 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 9600C8D0001; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6836F6B0075 for ; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 397C81602F9 for ; Mon, 17 Jul 2023 13:26:18 +0000 (UTC) X-FDA: 81021177636.23.4D35F86 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf11.hostedemail.com (Postfix) with ESMTP id 28A8340007 for ; Mon, 17 Jul 2023 13:26:13 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; spf=pass (imf11.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=IYxz/hwKzYk9uuwe3O6nxmJnxJXAWQADQD0MlDZJ4Kw=; b=afzjjvo0O1IH7WK5ZT2Rq0gcbg4lKGGyotENdoN4V14S2WzPr8W90TgAps7jNfndMSZtgP FeXk8nzAPyHM1gZcRwQN0xeDQA+lRTT+xmywFoClfhGEBMMM66+9uP77bii/9HE1P0IWqU 3pqb4+l9FTbcwgBuZV9+yU65CqK9Q2U= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689600376; a=rsa-sha256; cv=none; b=SeYe1EfcjnEl9RDci0csNdCzLhydGa9D8kJBC6f4luW1HsFL+WtRnYkBCTiB7PkpBmeCFe 0oJ/HhI1I8OECBNc5gFQwQlhidjSARPlW45avGlEHC2OowibAaLFdn6jNQxcGioELI5EBF w7wa3G3Wl5DQ1pgNjQPVKgoxbC9eufk= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; spf=pass (imf11.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 Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R4N9z6YCzzrRmJ; Mon, 17 Jul 2023 21:25: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; Mon, 17 Jul 2023 21:26:09 +0800 From: Peng Zhang To: , CC: , , , , , ZhangPeng Subject: [PATCH 1/6] mm/page_io: use a folio in __end_swap_bio_read() Date: Mon, 17 Jul 2023 21:25:57 +0800 Message-ID: <20230717132602.2202147-2-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-Rspamd-Queue-Id: 28A8340007 X-Rspam-User: X-Stat-Signature: u8ajyo1y7i4xccs67kprdh8saop8z3wa X-Rspamd-Server: rspam03 X-HE-Tag: 1689600373-250046 X-HE-Meta: U2FsdGVkX18ij51PTlm0msd28NnNHKrKu+j/fzYThbE5dc7wRUyVM0qyjHYvVSYSoTONO/BGSc1tH4WMg5gkaCltXtvXBgmtQg4k9MLbDLTpbRgFo7uBMK7UwSSDEzmnVhc9W1JInAd78KAmxW2mvdyGeRpniYpd5SBMotmK0zljUTiovs7lh3tl+X6/O62vRT9ECvntWoM5zEXmvZdD//eu5aFvPnl8BBsx7fsIReLI0PkIPrx/XZo1WqknQGrbiixKYeZ6tkQaAUWA9ZfBo70DETrDDCtqS1evNSB6s9Dhnb0H688cItb+zfNulJ06TAB7sq62hdbEqhoGHAJq8++s1y305N1Z9PQ9Qu7Q5HbYKsXJmu7cRZB8qlCiyVFDwloVORUSCn2LQroWbYtt8l2n+FqBTF/J8wZFKey3kVyQouL6wvT0AGw0m/Bx9LCEG7xphwlzrGHus3zIi2sJ7p9233pGO9QZ2uTwY/8gOc0Nmu2CjytFX7KIfJ6ljDVuExL0CKT0wU0Is827R4QpDqqXxXawfN2AaMw4JC6G4S4uEVH1fc1wTsBbU82IAk2W1uz6/gyab39xLlMEomnUdtgyFfqq184pW3gPl9NyIYoRMAyfaInunOOqND/OudOPOs4xB2xwl96hFzCWmarjkiQcb9vLthctcfPey6mVL8OSt9Hl1jTHwYyGd7opvGPEjgf90D0CsPxbi3/FqFdLColGbjlR0RqJwyxROkPYQfiiYMic9jP8KTJKvSWjsPCRyXv/DRQczQWsUX1v3SeKYtQihQN7TSUnc6bZmdFd9y06wjyco0q2VTJ42QaCWj0D4EBKRZOllGljVRx1Yx+eoWqHTfQ2MO8Mfpo01vR5MxPHZS7yEvMVLL9pSH8mX3FrVL9k2L+cKiTRmcMNoxYUrQLLva2sRFm3yXPEt/TRpyR1xKfoS0QZNJwE9AY7gDDX94XWEhJSY9hkYfC8R4r hEUq9A2N /X8FdjjDc8h746ZsI61aKHKjkPoR4jGzfTHHZRfc3hS4lCPS2Dv5LvIKuUaBq6SubVl26a4oY5l+ZfYRH2SnHJ8NXog15I3aHBtEskkYf2KzwBXyhKiojnQC5pa8FshSZYA2mCkevu5VVB25ycsNikJ3WNNYKXK/FqByxSzOwHq4ixxdtfq4RTzm5PEwX8ZScsZkq 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 three implicit call to compound_head(). Signed-off-by: ZhangPeng --- mm/page_io.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 684cd3c7b59b..ebf431e5f538 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -58,18 +58,18 @@ static void end_swap_bio_write(struct bio *bio) static void __end_swap_bio_read(struct bio *bio) { - struct page *page = bio_first_page_all(bio); + struct folio *folio = page_folio(bio_first_page_all(bio)); if (bio->bi_status) { - SetPageError(page); - ClearPageUptodate(page); + folio_set_error(folio); + folio_clear_uptodate(folio); pr_alert_ratelimited("Read-error on swap-device (%u:%u:%llu)\n", MAJOR(bio_dev(bio)), MINOR(bio_dev(bio)), (unsigned long long)bio->bi_iter.bi_sector); } else { - SetPageUptodate(page); + folio_mark_uptodate(folio); } - unlock_page(page); + folio_unlock(folio); } static void end_swap_bio_read(struct bio *bio) From patchwork Mon Jul 17 13:25:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13315706 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 EECE3EB64DC for ; Mon, 17 Jul 2023 13:26:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 05DDF6B0072; Mon, 17 Jul 2023 09:26:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EB80B8D0001; 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 B0C8B8D0005; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 899476B007B for ; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5B5E4402FC for ; Mon, 17 Jul 2023 13:26:18 +0000 (UTC) X-FDA: 81021177636.25.B68FB81 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf30.hostedemail.com (Postfix) with ESMTP id A6F7C8001C for ; Mon, 17 Jul 2023 13:26:14 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.189 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=V7vHzbTqeW7JilGe8vNV9ImKVDt34goczj++N2ksBns=; b=RurQO+pV3RU6zE/FzARPXYfZx1/bpTo4FG3UOPujhOtaeK7xDbZlD4GwVaBDkwOxISb2sk WYzI7A/NVw4beAds5Y6D555X8ODBWo/M25ACjtT47rXDPsRWZJfZUnAAjLxwKIjwCd4ZrV zeSTZONv5hL4sDv4LYFLcF6KtiO0HBY= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.189 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=0R4LglMVpZUfmSLf1qwRek5U3+3T2unS6pDS4K556qmc+lgF3n9fwZlIH/aKele1yMSeKp mFZGOPzhyjoeHDHsU1VYBjZqKfsZutP6fTlc8GnUf0r77ujQL7iuMHkRhWz0SGbqBvaKLF +oLpNXCP//UUcGApuK+72B5ub2HZRvs= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R4N810KhdzLngj; Mon, 17 Jul 2023 21:23:45 +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:09 +0800 From: Peng Zhang To: , CC: , , , , , ZhangPeng Subject: [PATCH 2/6] mm/page_io: use a folio in sio_read_complete() Date: Mon, 17 Jul 2023 21:25:58 +0800 Message-ID: <20230717132602.2202147-3-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-Rspamd-Queue-Id: A6F7C8001C X-Rspam-User: X-Stat-Signature: atysj36k4ndmfm4tmhybeg1gp4kwax3z X-Rspamd-Server: rspam01 X-HE-Tag: 1689600374-189069 X-HE-Meta: U2FsdGVkX1+iHEbhvNtKMUNPIVqfgsloXUThugUgIxPZDqKpG35NSCBYFI4AS5El65gMwdnhoAwld6dUReyE8m1uNeilHNhDMA+IgwLiR62DOMEdsUBc8uRjprficiN9xoB/7/ejCZHF7nu8Ph4Ng5PnP+c7sVZYfgYSBhD97+rYokOhRAWo8aRtNLpzaBZ5G4/HLPl3UDv3foHrwUxEYmylqnvYh26ur0rcIBBEZT6RHtjQQm2kaseBQxu/F3WhEVsckA2xul0BCaWBZ7WYETzqZplYaHpg+aZBUywkf3EyWBvbDof1rBisyCXXGlsKhP+QLId+j6bV+jajGTx1OcrxvUE9T5Pv9l1cml7h4vLtb1FrqzmT6DG+sCAA60bEdYcKYrQprN9csFsNPKbEZ1R9DH4DZAqMfHZdDRQos9H7AahBDAPvPmUt8yOiYeP9IDpcMOoRdTjrJOY31LV+6On1l8M2LthxmDQUitzdTaaerexTfOcw8SQLMIPtgdE5n1lTkVT0agVvP/UgH6O9/3q1irEpMvGxZeTjDdyCtoSg4xKUWUNDsvKmt4bRvY200t0YuHqSpGS0hofQaro9S6G8UZszfwHipx66lwIcdhyeupslEgJeKy8EFxmS8vKClgW2hUAwMNNBVzrjLJxRzULTtoia4PibAMiwk0qJpkj5pORo8Cq29OWwUd0icl/05lb9PYj/X0DfstuY2+N2VqmSsakYPlKjFMTEenXVTe1C4zIv9/B+pdgdCvPBw1ZUEnf6wxPnvIm1EDnDYmuMPbpUrpOkqVRBVNUWaa7ImU0LmB8u3iv8uIlCVXVybGkat5sSSUkv9SMKTS31dV/0yyG5iHuKuu1zPpLq/CvVRYf+Rw/iCEBMgDu7AvzrOhyiWuqTR7jr1jJdDnh0bN5pGVWqE5NEI1uNaq3bRSsz1optypEUSlIlsdSbHW6yH47uXY+Vl2tU3Z3yhTHRcgO bmGx7YOW VyGvUm38NHKPw/HxiwfOEm1DqvtX7wgOsrbMQv+uT8HZ/RyTOwVaFjNghKrnPgELXKnOSY4UshcN4IP4Bd7mfTNCbS3raTz72kXj/xWHFPlaVmzba95SJ0jCUD1+dIrBpf9rdRYZI5uWIAWRAbgCwiMgqRQ70e4H/jxfhTOdAGX5OnLSqX0fBy948WLVibXxKWsq0 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 three implicit call to compound_head(). Signed-off-by: ZhangPeng --- mm/page_io.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index ebf431e5f538..438d0c7c2194 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -406,19 +406,19 @@ static void sio_read_complete(struct kiocb *iocb, long ret) if (ret == sio->len) { for (p = 0; p < sio->pages; p++) { - struct page *page = sio->bvec[p].bv_page; + struct folio *folio = page_folio(sio->bvec[p].bv_page); - SetPageUptodate(page); - unlock_page(page); + folio_mark_uptodate(folio); + folio_unlock(folio); } count_vm_events(PSWPIN, sio->pages); } else { for (p = 0; p < sio->pages; p++) { - struct page *page = sio->bvec[p].bv_page; + struct folio *folio = page_folio(sio->bvec[p].bv_page); - SetPageError(page); - ClearPageUptodate(page); - unlock_page(page); + folio_set_error(folio); + folio_clear_uptodate(folio); + folio_unlock(folio); } pr_alert_ratelimited("Read-error on swap-device\n"); } From patchwork Mon Jul 17 13:25:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13315707 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 CBD8EC0015E for ; Mon, 17 Jul 2023 13:26:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3210A8D0001; Mon, 17 Jul 2023 09:26:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1EF4E8D0005; Mon, 17 Jul 2023 09:26:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF3468D0006; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C13A08D0001 for ; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8E56F1602C3 for ; Mon, 17 Jul 2023 13:26:18 +0000 (UTC) X-FDA: 81021177636.22.5D5641D Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf07.hostedemail.com (Postfix) with ESMTP id 96A184001E for ; Mon, 17 Jul 2023 13:26:15 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf07.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.188 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=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=1sq7sILf+rIS36Fm062bRML42UHcoJOwmUD0+cxBZK0=; b=ouHxj04S9XxA9q0dRomtn82YYxmhCNb57pNDpb31tKUOsdilDSws4yiSEpFNfE2Zk3msxh pNsnfXbo+zE2YBtL78wYesu2Tyyzguz5hZD4exeH9wi/QG6uw4LgXAtTezQAFtwQDOrP3V 1tH6aeLkZJE1qHIirh0O4lx4wJY0dHw= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf07.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689600376; a=rsa-sha256; cv=none; b=3LjyZ118PTN7Z14stbarbpYkphLrTiwd/uKeQNkH4X/yD+QshYllyHQoVeJPo2RzgrMPuF JvSe8+utAsq2qmwECiZPkn8Sn04EF85NpfXIiSD5LZYos+8DUorqxQk7gBp4++qqJRJZDQ Tfz+R2ZgEf9Ib40Ztx/QupVtjSHNieo= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R4N701MT9zNmP6; Mon, 17 Jul 2023 21:22:52 +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:10 +0800 From: Peng Zhang To: , CC: , , , , , ZhangPeng Subject: [PATCH 3/6] mm/page_io: use a folio in swap_writepage_bdev_sync() Date: Mon, 17 Jul 2023 21:25:59 +0800 Message-ID: <20230717132602.2202147-4-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-Rspamd-Queue-Id: 96A184001E X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: prhciiwrw3yh1uzmwyajexpuybzyb6jt X-HE-Tag: 1689600375-909502 X-HE-Meta: U2FsdGVkX19s1EjcAUIDCW/zCY9OpXgtybhiVfXteQGaIgMWmzl2Nk/9mchvUkk7zwNUfnEbLqT39FSy4A02bdua1ZQpBth+IEL6tehT4gFP32waTmfDsWeVu14aqW6uKeCsS4x/9wkB9n5ZHqQhUKnI5pgo6chj6dhxwnWiVfWQZG9DBG4SBuCnbZtx504JuUj84jPccSlR0d2NcvkleJM8jo2gHw9dBMZ/cZ3fAxmtcRMNqaSQ5ISs1hKUReq5OsDdghJTGjxdcDMfksOardKE/NqjKyMjbfCMwiwVp25DLCIkPLLJqhTGI9uoZxfu1WY514skjNWuuXtRbmhJd45Lvg0L38ayagSHbz2MzFnf5WCA1337f4WmYAQNU4qYXHxObdMtYBnC0z6x67Ktcq2mE2xQc8WZvnhPIQnPkhnH/SljowEBUQkFlRfAAFy5hDUruB7nhI6rOjNCF1EQfo0/6KxWzugZfQkFSHVaPYG5EJ58cNXocU8EEUlNAN7Vtc/EHJzc/zrx9/Wnutf0lqBNJYqg1rRJ7NGq89+TLFsgRUXTe8sd2XM2aM/Pf3BGJipKvc078snew/Q6FXXtOhomEyUIevBBofvEgMb2Pb0aHW7Cm++6EK2ePsaGPhkoV5JGUfYgclZ4U1p+BvdefCqMOdyS2uaHvfo1OGf4minOmMc1ya6P2IMFuUbrVcgUyWyGB4RTlpjKPqlHdHKyq92ovaR2u38miqJUnWlOSHn+Kzlag5gQby8iMii+V+555GGhlBiw2aQQItn244BrIkdkMHoR5uDhuZjei/Sy2ShsnQIMlpBL72VL30f8DHlO6KzFpRlfeYcroIWZokVUikydLmIuL49o0vGSShHxKtydYx2mC3tE663pWQjUzZV1CZ6AZy/oKepfBJF9BOzrzw9hhTG1LT+fnprY5/sLdvq8YrYhwqZs+MU4JcYvXHcb41TIx0vN/EWPay+IVK1 XlSxcERk 45Nhoyzet1AAE52t18gT5xAq47hQIR6YW/nahT9pJ493UuAkHkXKAKhaN/vrysqtmsqQMUINYSCbpoBIJmFPnT2C4CVyGTLKzVYcdDnv+o6MRETsA1Y3mh9l0ZV5InGLm3EXmzlfaWr2vdbKRLQgALeCWbApFt+/CbHfYlSdxsQVDuerTf0JLeX5L099fdTet8PP2 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 438d0c7c2194..f24f814b8dca 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -334,6 +334,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)); @@ -343,8 +344,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); 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); } From patchwork Mon Jul 17 13:26:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13315703 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 D21A2EB64DC for ; Mon, 17 Jul 2023 13:26:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5DFFE6B0074; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5693F8D0002; 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 4157E6B0072; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 285E56B0072 for ; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E7035802E4 for ; Mon, 17 Jul 2023 13:26:17 +0000 (UTC) X-FDA: 81021177594.28.39112A9 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf16.hostedemail.com (Postfix) with ESMTP id 99B2918001A for ; Mon, 17 Jul 2023 13:26:15 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; spf=pass (imf16.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=Qk7XnrD0b969s9nWEgz0gzW6UZ5a40E63/38o7Yvwt8yn5gyXHyZyiZ0TI/RSmV2FDh27J DoC/bBSrn9j5nACUQ9DlvzSfyqBNT85VHXmZW75sG5ENZ3Eov2JveP7AlZKZeJQ4+sLOdn qCOlNqUygGfuWKmJjYKYUq00Mpk8OGc= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; spf=pass (imf16.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=vJ+qedAJ3nl0orQtqLDDbaTMpVKcZimuaXBGhCdSkuU=; b=oZI51Qai9o6pWeys0aRT7BZzlwp1Jipz/8GNYsIkFg1GRr8T1+aHk5c9EAfTiKGoABzfox FF6ly/ErvacT5Ecfpr8dTwlkZpiHGilidkFKKEUNCIathQWXIvsYPkKGn2UGdyVf25Px6y aqkkmB2toHdo/Mzv3IQz36b5ypNvzXU= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R4NB24P85zrRlt; Mon, 17 Jul 2023 21:25: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; Mon, 17 Jul 2023 21:26:11 +0800 From: Peng Zhang To: , CC: , , , , , ZhangPeng Subject: [PATCH 5/6] mm/page_io: convert count_swpout_vm_event() to take in a folio Date: Mon, 17 Jul 2023 21:26:01 +0800 Message-ID: <20230717132602.2202147-6-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: 99B2918001A X-Stat-Signature: 3rcsn3zsm1uyszt55f4jtgqw88363bpu X-HE-Tag: 1689600375-442299 X-HE-Meta: U2FsdGVkX1+6/l57RHX79j/FzqnlxUgzPraEpXXQuCDQKiac7awtVPV6vxh0DeHCPuBDgo9s4M3iD6TJa0qAUh6jJTZRroyBSSMFl/FCOiOCTYwdwuTqJaH4Mq5MoPedAAIdBRlGK+BJ6DLeDr4tkf27BqxpKwJVVgRrJLvbgT+S+vxGVGQra3kc6M666Wb5r9UVA+MkH8SYnos1/O+bsD8d6J2Hrv73oXfCUca7i9xGX28YqMocSw2sMYEUA6A/F6UkP+i3s7roY+2lDtoOFsvD+BPFVmrJnVXPJotH9tyyETxrQbnbOUFBQhqFlElk9ADIBA9YcZE5To7G84KRoaNtkM7pMlSiezWHerEH6TGjCekPPFcbFOQyaUZi+S68tazxq/dsViyyRc3r/qron1VZX+AjhRwU2OYpgN73GnOvqanpVTVZltHGmX43118j+8hfbcz+OTW5x80eUbESvWNRpF5Ea3kyeBqHGgWc9fOw/s13GF3SSI6apK/l3moS4b0Y18DckEwjW+IB087vupYT0FmZ9a8IqYmT/oDMa3xoueZ77p32E/G8MQfhULomYf2msUMOYX7JmIYlormcmnw/E4TembCaytiESsK+SYyB+sYsuciJhVzR7i6bspakWeehUIHWq40dKFKe+HX/wMbIf1BCpINKMrqkpHxFfeF9shDybuxgPjjrAw41IRSQTXUTEsh06xi0R41goCFN1cld6VV3OAJzalarIxfSxxTt8xet741yLkhHddK5+dBsS/9twrN+IiLN9szbPXYao2xwlK0Ew/EFHuawodWuhO7cv6FE1TNAoKWfhU9737tu8gpQMBkTvddB1y29o4Fc8mfV+XZyrJHrW8aiAVMTGQ7td6A87IWPtSobLAn7F1w0S45uYByqTpxRKnDH4RFCEXNOj1JuPLrqCD1l4Rm7SYbfJfFm2VkTmw3jDMV4+ksCW5SI5SEvZowLYclfw1l UXopmS4s JXzVCJWOSZqmrD4nNV1ZbGsJYo7tRkpT9WgIANXuyljbYGeMwqvVab9ng3vpeISSt2yvbI2mdXHAuFi6hnTeNszF64w1LpcAleRn/mYYAW5G4IYGrzwdgPJB1yatOr08OCJYThtvN1WqZCdaW1xCQ+jghBygeGiiz7kQ07rfRer/mJvVnSQFWQM1nrAl/bXEeGha7 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 Convert count_swpout_vm_event() to take in a folio. We can remove five implicit calls to compound_head() by taking in a folio. Signed-off-by: ZhangPeng --- mm/page_io.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 84cc9e652451..66e8403bf96e 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -208,13 +208,13 @@ int swap_writepage(struct page *page, struct writeback_control *wbc) return 0; } -static inline void count_swpout_vm_event(struct page *page) +static inline void count_swpout_vm_event(struct folio *folio) { #ifdef CONFIG_TRANSPARENT_HUGEPAGE - if (unlikely(PageTransHuge(page))) + if (unlikely(folio_test_large(folio))) count_vm_event(THP_SWPOUT); #endif - count_vm_events(PSWPOUT, thp_nr_pages(page)); + count_vm_events(PSWPOUT, folio_nr_pages(folio)); } #if defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP) @@ -283,7 +283,7 @@ static void sio_write_complete(struct kiocb *iocb, long ret) } } else { for (p = 0; p < sio->pages; p++) - count_swpout_vm_event(sio->bvec[p].bv_page); + count_swpout_vm_event(page_folio(sio->bvec[p].bv_page)); } for (p = 0; p < sio->pages; p++) @@ -342,7 +342,7 @@ static void swap_writepage_bdev_sync(struct page *page, __bio_add_page(&bio, page, thp_size(page), 0); bio_associate_blkg_from_page(&bio, page); - count_swpout_vm_event(page); + count_swpout_vm_event(folio); folio_start_writeback(folio); folio_unlock(folio); @@ -365,7 +365,7 @@ static void swap_writepage_bdev_async(struct page *page, __bio_add_page(bio, page, thp_size(page), 0); bio_associate_blkg_from_page(bio, page); - count_swpout_vm_event(page); + count_swpout_vm_event(folio); folio_start_writeback(folio); folio_unlock(folio); submit_bio(bio); From patchwork Mon Jul 17 13:26:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13315709 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 59A4DC0015E for ; Mon, 17 Jul 2023 13:26:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F5E98D0007; Mon, 17 Jul 2023 09:26:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 47E768D0005; Mon, 17 Jul 2023 09:26:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 283B98D0007; Mon, 17 Jul 2023 09:26:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 062038D0005 for ; Mon, 17 Jul 2023 09:26:22 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id BAF661C874B for ; Mon, 17 Jul 2023 13:26:21 +0000 (UTC) X-FDA: 81021177762.23.7BD4471 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf18.hostedemail.com (Postfix) with ESMTP id 2318A1C0017 for ; Mon, 17 Jul 2023 13:26:17 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf18.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=1689600379; 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=4sSpnbOCGI0f8tYl5oWsmEUitL7U2pCM9ujFaXA0EZk=; b=AD3fltVnLDbsykr5ea4sGJoKkk9KzvowKIwDFhSwWaIcsecP0dFkzJDs8K6VBQBFXH3/IH 9Yp2xkoLt45hcN+v97p+J4JyrxaYjQR/KN9Ow70YiSHObH70QXc389UPugysv6srIMri4+ bZlnFf4xppHAspsPr4W+Zlvb4CeJDdA= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf18.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=1689600379; a=rsa-sha256; cv=none; b=UVL9f3fsRbmNaYDM683I8qjqV1dG95vh3Y+4UHQf613OhIWQrSmO5I87LGMEuePdeqwD5G ekQaBnhteppP4CyXhdpzsAQbNsu1ITDv0s6CgLbxT38PNnr6hkIVA1XQyWHDY33vHfK6bB 6lNR88RkWyYmT0Ul/evUlRneO1zX+zE= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R4NB406HGz18Lnb; Mon, 17 Jul 2023 21:25:31 +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:12 +0800 From: Peng Zhang To: , CC: , , , , , ZhangPeng Subject: [PATCH 6/6] mm/page_io: convert bio_associate_blkg_from_page() to take in a folio Date: Mon, 17 Jul 2023 21:26:02 +0800 Message-ID: <20230717132602.2202147-7-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-Stat-Signature: czwp15ybomqsmmihbeeb9p7yjhdix7er X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2318A1C0017 X-HE-Tag: 1689600377-665125 X-HE-Meta: U2FsdGVkX19lQL1W2ieQ7IpKZgHMK13jvq3xOa22Mkw9Hq8fzs8q9m3bzRrVvbAx/Bk2xMLmduAbhOIcufQZ1yoOJKz4BtaBV/84dYrb2jbvIBgOeSLys/M/ctZm2NI/ZqfajEMThsLcqbTb5oFE2OsP4PG3CzI9YOXIp+hv/Nd7B2FyQHzccYPEktC/PG45Gsoou+Y8o9JwLEkozT+TYo47xSB9x6x77xCugprvCeE94WbhRxR4YVZ3BhBRCEpc0VsJdHEae9463ErwFmAw+bjHjjBFkbfgc94yUnxPg8EU9H0hkZp7vSq7ExzPziiWl63/kDiPqhP0QCFAe3t7fwYEQjupnhX+cdhj9mxvhLaE1lPVcDRG3CQqCpP/1OE3wqUNTFbVrSVKn0Zo2voqHvP1KLp9oaRmSNCvmKykohENe+SlrPxe5CMxHbd/yBZvA2tgD1DFDHvx39N9V8P/tyn+4zlQeY+PoA7UQmFiycJPbzU4mdEsQeL/8WmG+tHe/nVtE7p+Jd1iAMMdTz6Y7UDCqq8T16JLDEYh2buleP4nxqPhyvbfxW32bJGKUdQi//aAifk0fDBk771Zl9ZcUKkQDvYzishoIUxa8I2YXLJ8UKF8b+haE8QZZLc2hz1H7RMgzvOoip6ELO/mzk7tJ7a9L4KO9qs0e+2EVTq2ZZNLkr6Z7U66uMTRK1Eu9NxV5Ut9rWBduF4lQdIgctZaw++eDN0Lw+CB/xRuaXU0Sz2Wa5M/5O9XhkwA+TY9s01UBDP4OCcClmcMtR23N/klgAbV2/aqVQpRHyEqohPsDNYRZYkZSBzLYKdwd16FFgsx3NzeTMPuNh+2ZZzsWAqKu/KArp7T62wrwDDOdqUpDQEk9zvqIVqpHo83kKazoiN6bUXY/n1NfknDkOOuw4+p9mHjLt4VwAUipx3hLtE+grlBODRD6y23sO6v5k30oE8qPI9AYURgeHYm8IsxrAv EBxLakfM sv0cRF3YN+1re9amxrTmi+A+ILFqv06TfqkvbclA2y6JQfeWeJw0G/xaeaITU8N90FJ4MijWFBUhTNCFl9Fp93Y+AEIF53o2k1Ei1AWjW10g7bD4D8SaEqNM6NSgI7zPUlEoyGZ+b7jNW20f18BFQjRJrxZZ+s39Uy7jaNqaVSnHiekhWA6PcKEOQiKDlrIr0/+zC 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 Convert bio_associate_blkg_from_page() to take in a folio. We can remove two implicit calls to compound_head() by taking in a folio. Signed-off-by: ZhangPeng Reviewed-by: Matthew Wilcox (Oracle) --- mm/page_io.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 66e8403bf96e..3c1fede46bd9 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -218,12 +218,12 @@ static inline void count_swpout_vm_event(struct folio *folio) } #if defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP) -static void bio_associate_blkg_from_page(struct bio *bio, struct page *page) +static void bio_associate_blkg_from_page(struct bio *bio, struct folio *folio) { struct cgroup_subsys_state *css; struct mem_cgroup *memcg; - memcg = page_memcg(page); + memcg = folio_memcg(folio); if (!memcg) return; @@ -233,7 +233,7 @@ static void bio_associate_blkg_from_page(struct bio *bio, struct page *page) rcu_read_unlock(); } #else -#define bio_associate_blkg_from_page(bio, page) do { } while (0) +#define bio_associate_blkg_from_page(bio, folio) do { } while (0) #endif /* CONFIG_MEMCG && CONFIG_BLK_CGROUP */ struct swap_iocb { @@ -341,7 +341,7 @@ static void swap_writepage_bdev_sync(struct page *page, bio.bi_iter.bi_sector = swap_page_sector(page); __bio_add_page(&bio, page, thp_size(page), 0); - bio_associate_blkg_from_page(&bio, page); + bio_associate_blkg_from_page(&bio, folio); count_swpout_vm_event(folio); folio_start_writeback(folio); @@ -364,7 +364,7 @@ static void swap_writepage_bdev_async(struct page *page, bio->bi_end_io = end_swap_bio_write; __bio_add_page(bio, page, thp_size(page), 0); - bio_associate_blkg_from_page(bio, page); + bio_associate_blkg_from_page(bio, folio); count_swpout_vm_event(folio); folio_start_writeback(folio); folio_unlock(folio);