From patchwork Wed Jul 19 09:58:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13318701 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 0D5DDC001DE for ; Wed, 19 Jul 2023 09:59:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8A92280044; Wed, 19 Jul 2023 05:59:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D1946280046; Wed, 19 Jul 2023 05:59:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9280E280044; Wed, 19 Jul 2023 05:59:03 -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 81643280045 for ; Wed, 19 Jul 2023 05:59:03 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 4BED8C022D for ; Wed, 19 Jul 2023 09:59:03 +0000 (UTC) X-FDA: 81027912966.07.D53875D Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf01.hostedemail.com (Postfix) with ESMTP id A56E040005 for ; Wed, 19 Jul 2023 09:59:00 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf01.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=1689760741; 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=pYlzkQAdk4AUL+lQrQcLU4TJsQEB6E3ePvUtD+d2i7U=; b=jcYeqZs+ZiXZtli7LuQpz8Kkdo4Fk4Tb2/pFnp4IpRtw0sdG0JKLHZ0zq1IH7DqNywX26K wC/eFf42gZ1gr5/CctlSLC0gIn8gk68ZM7AUGXN6LUiDDREZ6d2KXf89Cz4ZMSyA55ak3H YfnM0oBiDZgbFA+6w0/mdF+CNC87OyU= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf01.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=1689760741; a=rsa-sha256; cv=none; b=E49oT10MgJJX52mzdRt6XiGzzmW+s/QCbcJv4X7/d2Zd9F2dx5zQF260oEMhL6UCSgtUW7 W2o+5bl+DeCipGtAHQY1KxnaI6MebYOn4zkwxoD5K81uaSTDqW/YdzZ2ClVsNJEhWEhHfQ Fzrdgl0VZJvdsRJDH0COdGQ5JNhB1sk= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R5WQv0tvZzNmSH; Wed, 19 Jul 2023 17:55:35 +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; Wed, 19 Jul 2023 17:58:54 +0800 From: Peng Zhang To: , , CC: , , , , ZhangPeng Subject: [PATCH v2 1/9] mm/page_io: remove unneeded ClearPageUptodate() Date: Wed, 19 Jul 2023 17:58:40 +0800 Message-ID: <20230719095848.3422629-2-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230719095848.3422629-1-zhangpeng362@huawei.com> References: <20230719095848.3422629-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: A56E040005 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: jjja9inuez1st5671udq5z313ngziaz3 X-HE-Tag: 1689760740-149606 X-HE-Meta: U2FsdGVkX197AVrNp/oOcZT5pFIZ7iwV4Ebp01dRn9kEd+ZM1ouVBqIQ7xRlsvyqgdTNgSzZMjpVMV/UGQZkk8rNtxuqZ8xs+5P/mDZ6WJL4ZbGUT9vfYUjYbivXrffjNs5jT5uRbpBHOkzJIjwlbl1iXKNkmpV5KTR8b/lGgTLe2IdeR4LJTj/uhfZSEMYh6SnbRHD6YJvDhjFjWc3wkexD/x1vVnsmdgz1aiZwuDrbyqzMbrnVe4Om6AZ3KwKOFefQ7kiAxwg0ecVp/jOEV7m2Itg4Sj23XzApLADOW2SH0ncjYQcHlNfzpCQXdJcF7inFHc1rIHVj3JBmMu82igFYHJceJcXV+bsI0rc8DybSt9lf3XWgk6JERZn3/Q2DCn/N5tbhB5pKRs3SzgMmemcOiUGBAMLMTSz9JfNrZs0QfZZrgFhHTf7QsuyAhxdWOJFrnG6482ZUqVKVlqz9qsrPwKCFQQr6Ejbe8idRbz/XJWHB52dGsiSkB+PIiIkjeMpojGHx/MfL0PD3NYDdvKY84zG2qhLTOt/fRqSAUiscRLOpkmQ0MMphbmQolfoAkYNoE4BM0l4+iRl0zSmo5ZiNTig3Mui1Yfwh8W36u/ZBgAoHlhSti/yrK7kmDB36NsuJM2AvXp34HdNKaYD6ZSkZ6ykVXdJZGr4pM03zClLmCLKG4Emj5gQ95h7uwiXU87KxMzc+GtrNHpIzjY8REE1SkDHQqd6Y2y1noU0IPVYT1c63onlrKv35PX5yO+AcFYZ3Ko8AzlUaSUZzY1V7ALlfxcFwMI7cujht3jTgJJwwzLzzMb7QDmF+/1FIW70q88Y/kpFkl6nGarrD12n48k0NWYYEyH5Zt7DvVLpQo8RHE9MjDzRKVHngqNdXb8Dc89Rv0cvenA9vzW2feIfSkCDKeP5evC3NKLxqGgI9oH83J+FpOtORzHl1ecLztxnBlWvRjVkJMQLOOz9jIyD 7RXPCc6o NbfxtHMxPB1nOLRA8Mu15u6W3xnvKJi5Q/3QX5hnLlc31weav5upI1Qbafr0gEXp8Nz6BKRyDoMyMLna6eF1Skee9YNSY+qaMi2265RZeP3J4Jhxoi0UgAaSQTE5P1r+x47p5ar0zM8x0qpCfNXcIs+/Z7HLjpmLLP0aMMYsMSxfG1ivrBCl3t04fNMRLfXgCL2pBCx01tUVclXQEMkdCOW79BE7xbLi+Swaz+CcCEFbR8UbZVguddOCiiQ== 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 The VM_BUG_ON_FOLIO in swap_readpage() ensures that the page is already !uptodate in __end_swap_bio_read() and sio_read_complete(). Just remove unneeded ClearPageUptodate(). Suggested-by: Matthew Wilcox (Oracle) Signed-off-by: ZhangPeng --- mm/page_io.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 8741d3a0d48a..3087a69a014b 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -62,7 +62,6 @@ static void __end_swap_bio_read(struct bio *bio) if (bio->bi_status) { SetPageError(page); - ClearPageUptodate(page); 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); @@ -417,7 +416,6 @@ static void sio_read_complete(struct kiocb *iocb, long ret) struct page *page = sio->bvec[p].bv_page; SetPageError(page); - ClearPageUptodate(page); unlock_page(page); } pr_alert_ratelimited("Read-error on swap-device\n"); From patchwork Wed Jul 19 09:58:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13318699 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 7B129EB64DA for ; Wed, 19 Jul 2023 09:59:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 92AED280047; Wed, 19 Jul 2023 05:59:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8A63528003D; Wed, 19 Jul 2023 05:59:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F7DB280044; Wed, 19 Jul 2023 05:59:03 -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 5C26328003D for ; Wed, 19 Jul 2023 05:59:03 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 297F2C022C for ; Wed, 19 Jul 2023 09:59:03 +0000 (UTC) X-FDA: 81027912966.05.1107E49 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf05.hostedemail.com (Postfix) with ESMTP id 8CD9B100003 for ; Wed, 19 Jul 2023 09:58:58 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.188 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=1689760741; 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=wN9Jy/8pPyEHOuZ2Lb/sCQ9C45wtfFLi31VZgiAcDtY=; b=K8o6BWlfGMRIH5Xj9IB+/vocef+3WReadbrYKfu8L3QK8BCeFfFdeWRX8NujonJ5PuX+Yy NJj+VjF0DFq/9YvdYEmDrqDCllEr9Z4ZZDqyhpv0dqUNh9UepIkLX6SjOrRr/QB3wGN/Ub B26slukMg9xNoQeTTljksHldjMF59Xs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689760741; a=rsa-sha256; cv=none; b=wk3gQLQ+hYd5bqNVwkWP9yn2kvydscwPHF5MAHU8LnJNwSHcjsWvdgUOiuyJUDdR/3agmv DCE3PxH5dzqdDwcKDi+ggnd0vMSsls3nSI0v6anAHwVIzTCOW2SULlBXnF3qUpjC1Pkoqe TAtG0qeHaD5uAjDsD2jdUWF9/UrZp24= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.188 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.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R5WQv5t2TzNmPb; Wed, 19 Jul 2023 17:55:35 +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; Wed, 19 Jul 2023 17:58:54 +0800 From: Peng Zhang To: , , CC: , , , , ZhangPeng Subject: [PATCH v2 2/9] mm/page_io: remove unneeded SetPageError() Date: Wed, 19 Jul 2023 17:58:41 +0800 Message-ID: <20230719095848.3422629-3-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230719095848.3422629-1-zhangpeng362@huawei.com> References: <20230719095848.3422629-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 8CD9B100003 X-Rspam-User: X-Stat-Signature: f5u5jfsi9x566k5yrshd1w7c16di3t6d X-Rspamd-Server: rspam03 X-HE-Tag: 1689760738-809188 X-HE-Meta: U2FsdGVkX1+dND9z9vA9RrEifSEmx6QLUC0wyG7zU8MyrchoDWN+yEL6VdP1Ln2mdp6QHc4K751K+PofhSvzPtkxCr58c1Ag8VEJpOrmY7dVp9PoblMUr7W3WzE0mzobCspm86NHLe5Vwt82NV2dYI3Huw2Xj11XhjZQGLy2KSXKgn93zfxW6vRAbTgi5GaagIHbGcrhpsDhSXhuoRmFX32vkaw2S404lzKhJx5bp9CPF5B/1gJC/phJDNXtv2eoEOgo3FuLXYNApOLsLMgktNiPwETcSKpCk741w+vBJfKLOOO628dhpawh8jaonqkVpU6woeDAgwTBW1zlHCMAFMbmkyxD8mRA4ZqVYjnW9ydxNf6szj+3lD/kfI79h8DmdBllx3oG/Y5Q9/iue7mdZSGUwLV7HMVYv4FVU91Uu+SiPhF1zonnF9LJIjCgj64+OV/GxSJes7h9lMG2i8s5X513tE8hc0+u8y+uyWS5CSC5RZAXpxI8N1Jy82z+hXz9FcVhlxlnlwJ4luE5efSgAPxVFVBvZ5wxvzCY2NuLcHTud/adeMbyFu5GG43v2PjUZGR03tEfpk4/vPYL021cv7zkdxibL30zaBX8Q1tPH6hNWZaQyCD0/x5SqSoLedJV27B0U8O95HidNo9ioalZ5LZrn/GANf6/OQtM0P63M+ABwF+Q3cMpfSGeJUHTJfYawIwyEoLsMARuvNWtEs8GVfuLUoIQYnCVijcehlnP6iFroFYFB3+rjVwxcbCoaFqpmnmOt0oBGeazlz8XFUUGNhR5H/6g3972u/GKY+2i4Z3NzL0KmoyfEdRMmWblNQ5WtzVCBYNU08chQY/+5upCLmKrSD0hhIqEDK5hNAW5RmQHb6JafTs8d8iqDV1QpDXQQIAQA1BnEGqVjI+N+OZ4aok2TusH26+vke34O0qI4sl2ObvgQB2L2P5XVz2nJItDOASTv5UqvemOceNmMEf /qEH0lFq OI8D3FE39xV0rgkxPwkWu34Bb2uVj++108iHgleSN3237oGYewUqGa8yPVOSUWg64cECXDXYtjBTQj7blvG6iXoCLG54J8SUJPL4cTolQ7eQ+E175Fbbs2z12xlSzq+7RB5+6Ikp5ef98RxFF/zKXwiTILK4bnE35NJ6Xc+z3GGg3+jxyzUUntJpWoSM6+yZkj/si8Gbx+570Sqz2kTjgTaxrsl2Lp+XDJ8UQOISroMpd9cJn2rIqLpPzVw== 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 Nobody checks the PageError()/folio_test_error() for the page/folio in __end_swap_bio_read/write() and sio_write_complete(). Therefore, we don't need to set the error flag. Just drop it. Suggested-by: Matthew Wilcox (Oracle) Signed-off-by: ZhangPeng --- mm/page_io.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 3087a69a014b..5ddb5d9c5013 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -32,7 +32,6 @@ static void __end_swap_bio_write(struct bio *bio) struct page *page = bio_first_page_all(bio); if (bio->bi_status) { - SetPageError(page); /* * We failed to write the page out to swap-space. * Re-dirty the page in order to avoid it being reclaimed. @@ -61,7 +60,6 @@ static void __end_swap_bio_read(struct bio *bio) struct page *page = bio_first_page_all(bio); if (bio->bi_status) { - SetPageError(page); 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); @@ -415,7 +413,6 @@ static void sio_read_complete(struct kiocb *iocb, long ret) for (p = 0; p < sio->pages; p++) { struct page *page = sio->bvec[p].bv_page; - SetPageError(page); unlock_page(page); } pr_alert_ratelimited("Read-error on swap-device\n"); From patchwork Wed Jul 19 09:58:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13318707 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 F0CFEC001B0 for ; Wed, 19 Jul 2023 09:59:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4DAB0280045; Wed, 19 Jul 2023 05:59:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 487E128004C; Wed, 19 Jul 2023 05:59:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 30641280045; Wed, 19 Jul 2023 05:59:07 -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 134DB28004C for ; Wed, 19 Jul 2023 05:59:07 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D0EB41A0166 for ; Wed, 19 Jul 2023 09:59:06 +0000 (UTC) X-FDA: 81027913092.12.3424FF7 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf13.hostedemail.com (Postfix) with ESMTP id C7EE620011 for ; Wed, 19 Jul 2023 09:59:03 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689760745; a=rsa-sha256; cv=none; b=sA7wa6rBJI1T9QwESBqn/xEzNaRHzVtHAD4QOpP+VNkVmtDfwb4yS3lUoCwQzq3reCaDFa 7x4s2q5iRTZgCQkWNJw/rDEW0J/AAi8frzAxz/qHcICeUXZmnKkzCzD39ez2/W9POPC+h+ EgKQDZUP794gTUyonQ89t3Oibrnmm/U= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.189 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=1689760745; 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=JkdEw75PGEAD1hzTApmf9Om0rkylUsU2dhCGnIkdYhw=; b=uF55+qZQpPpkSIauyObqvN03DR9/pL1E+2idPRwob1asFIq57YsTJRDTG4atmPlqd24RGC xWdZLxpW8riNwDDqmp48JT5lG0OBv7csChLHGzuj5vkJ1y5UImLayqF/jaobMNOUmpmkMS jlHZYlaAEMkCMoM1H/Tz6a13jo6IWC8= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R5WRw64D0zLnrr; Wed, 19 Jul 2023 17:56: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; Wed, 19 Jul 2023 17:58:55 +0800 From: Peng Zhang To: , , CC: , , , , ZhangPeng Subject: [PATCH v2 3/9] mm/page_io: convert bio_first_page_all() to bio_first_folio_all() Date: Wed, 19 Jul 2023 17:58:42 +0800 Message-ID: <20230719095848.3422629-4-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230719095848.3422629-1-zhangpeng362@huawei.com> References: <20230719095848.3422629-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: C7EE620011 X-Stat-Signature: byigmfwoduuitosug7bd5sbwf3oci1g4 X-Rspam-User: X-HE-Tag: 1689760743-768829 X-HE-Meta: U2FsdGVkX1+DC7o37XVGV7xDNMEPmbjveKqfhfMn3huQNcr0QbOu5cJksvlbivA1YclnhIlXPuNqpAZCXlwDzkFaAdt0b8XdjC1LiYfZSdEEAe5DZp3VTf0hVSGg2HqGY/3ZtWucgmuh9NnId1nDq22IMJL8Zkd+BytMY7hkJg8hawSVO1++8dXx4qesP5do9n+UQfKw0/EuHrPFdgUW0f4xTXs/bozfcdsitnu5CGuMb7NmAgyubgVKSPhRnYIInAixW1mBvnLJovR3s3zUPjuAHkQ58GSzDCYfesIL3K5rFK/HROlyd8eJEfQV1Olj7Rz4h086r/Eph76zpHDLo37ipRyUs64gRKojjzpb3pawt0Y9KDY7zJYKLtafjEg4WSHTJd3S82vw4zKgTd8Q0y/5PB7UDMTDiBdcg77A7lSl2EgJGsEkARSjO06N8nmhNyw3Mm1D+S7e4aVbFJJNzMW6qDF1KlQ4V8HbV9jzjUBfIbUTelxpRebd4EoaLrp63oebDxHS3WZnu4rdPscj9tJGAw8o4tlA5MKNHITYG1z6/Em8Q+UodwHtIzjkVOQ4c86fxje6WwN/0upR7p5f92vFezZ0qLFLUXBfiTYhhRjmCFJH5Z8LNcZQozY4jgElVhNvPfk9h9FkMpZx9u6D7xrcfpRPNfB7Gdwo3HK8pdoi/lnT641BtNh2cf1i1mrGAWm3YnTsFnAcHHIWMm5RqJlSQeZOVTiNEi9jK6/cudGKPnb/NeZc7wjfyCkwQ03Lvtpi42Rpr6eUHHFjvaeYYENjmEMQ+M4U4ezUWzyA73SLwbBjt+Mwn8xfh85rF5W4WmvVUKVwPCAugkqChRaNTNzSYTi8vCZ+VSq932ZtbCymmRsUJG7ERQB00NcPB9tR0Gn8+IsLQA3iEikuZ9GRyGfuR2Xs+nbTlo/bfLMu4gWCzP6LP/ljAuA7xtUVsudKE0K04OndcCv6+Sk9FKD EUqalZGX 8iQkYkDwEjCbtTQH7rArFSqCpF6/f0tiBTajvLcnDOzPTmlGDl1EP7qYM55BYt537p9+RtsqDfiEW9lbQm21fkNI5kCG/PJa6RG5oecMoEPAey2ltxJnePZr+peTBG9d20J4H621OkXMsJpj4XzE2sznIEmM7W6ngnmPwX3nnY7iYfh0t1A+ld3GpZscI9ASE8l3FYy4BAz7ipJ6BcQKUQL2JrVu2EvfhCcIx7qc06XUOgd3AJa8NJaorNKErRXUTh66i 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_first_page_all() to bio_first_folio_all() to return a folio, which makes it easier to use. Suggested-by: Matthew Wilcox (Oracle) Signed-off-by: ZhangPeng --- Documentation/block/biovecs.rst | 2 +- drivers/block/drbd/drbd_bitmap.c | 2 +- fs/f2fs/data.c | 2 +- include/linux/bio.h | 4 ++-- kernel/power/swap.c | 2 +- mm/page_io.c | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Documentation/block/biovecs.rst b/Documentation/block/biovecs.rst index ddb867e0185b..258f6faed333 100644 --- a/Documentation/block/biovecs.rst +++ b/Documentation/block/biovecs.rst @@ -133,7 +133,7 @@ Usage of helpers: bio_for_each_segment_all() bio_for_each_bvec_all() bio_first_bvec_all() - bio_first_page_all() + bio_first_folio_all() bio_last_bvec_all() * The following helpers iterate over single-page segment. The passed 'struct diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c index 85ca000a0564..ce1a07ba85ff 100644 --- a/drivers/block/drbd/drbd_bitmap.c +++ b/drivers/block/drbd/drbd_bitmap.c @@ -939,7 +939,7 @@ static void drbd_bm_endio(struct bio *bio) struct drbd_bm_aio_ctx *ctx = bio->bi_private; struct drbd_device *device = ctx->device; struct drbd_bitmap *b = device->bitmap; - unsigned int idx = bm_page_to_idx(bio_first_page_all(bio)); + unsigned int idx = bm_page_to_idx(&bio_first_folio_all(bio)->page); if ((ctx->flags & BM_AIO_COPY_PAGES) == 0 && !bm_test_page_unchanged(b->bm_pages[idx])) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 5882afe71d82..6706858de984 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -288,7 +288,7 @@ static void f2fs_post_read_work(struct work_struct *work) static void f2fs_read_end_io(struct bio *bio) { - struct f2fs_sb_info *sbi = F2FS_P_SB(bio_first_page_all(bio)); + struct f2fs_sb_info *sbi = F2FS_P_SB(&bio_first_folio_all(bio)->page); struct bio_post_read_ctx *ctx; bool intask = in_task(); diff --git a/include/linux/bio.h b/include/linux/bio.h index c4f5b5228105..7d2979d24530 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -248,9 +248,9 @@ static inline struct bio_vec *bio_first_bvec_all(struct bio *bio) return bio->bi_io_vec; } -static inline struct page *bio_first_page_all(struct bio *bio) +static inline struct folio *bio_first_folio_all(struct bio *bio) { - return bio_first_bvec_all(bio)->bv_page; + return page_folio(bio_first_bvec_all(bio)->bv_page); } static inline struct bio_vec *bio_last_bvec_all(struct bio *bio) diff --git a/kernel/power/swap.c b/kernel/power/swap.c index f6ebcd00c410..2796ce48ca4b 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c @@ -247,7 +247,7 @@ static void hib_finish_batch(struct hib_bio_batch *hb) static void hib_end_io(struct bio *bio) { struct hib_bio_batch *hb = bio->bi_private; - struct page *page = bio_first_page_all(bio); + struct page *page = &bio_first_folio_all(bio)->page; if (bio->bi_status) { pr_alert("Read-error on swap-device (%u:%u:%Lu)\n", diff --git a/mm/page_io.c b/mm/page_io.c index 5ddb5d9c5013..e21d570c873d 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -29,7 +29,7 @@ static void __end_swap_bio_write(struct bio *bio) { - struct page *page = bio_first_page_all(bio); + struct page *page = &bio_first_folio_all(bio)->page; if (bio->bi_status) { /* @@ -57,7 +57,7 @@ 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 page *page = &bio_first_folio_all(bio)->page; if (bio->bi_status) { pr_alert_ratelimited("Read-error on swap-device (%u:%u:%llu)\n", From patchwork Wed Jul 19 09:58:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13318702 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 A1BC9EB64DA for ; Wed, 19 Jul 2023 09:59:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7C0B5280048; Wed, 19 Jul 2023 05:59:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F8CE280045; Wed, 19 Jul 2023 05:59:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59891280046; Wed, 19 Jul 2023 05:59:04 -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 48734280045 for ; Wed, 19 Jul 2023 05:59:04 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 21FAEB079B for ; Wed, 19 Jul 2023 09:59:04 +0000 (UTC) X-FDA: 81027913008.30.256484B Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf11.hostedemail.com (Postfix) with ESMTP id 4342B4001A for ; Wed, 19 Jul 2023 09:59:00 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf11.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 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=1689760742; 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=8pEhW7UStfxXp+iiPvwXWB0BJn1hLUjlYFivcxoOpKU=; b=Zfq1lwA+LnGHdKXwqJuZidsmYnGIkA386kcxgavz+XkKXqSm04fYvL4TalRGatnqXQ8Bgw kTIl08zEwVl1HiPm3BfTUAdukbObqCAcDL/47MXcS85NPw9rRbgmqdisMY9v1Ri+ymgbw5 RXO3fg6sF1mkcSARUSLt8Zy8cSJn3PQ= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf11.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689760742; a=rsa-sha256; cv=none; b=2K5ZMcQGvvx95AKD31tqLOP5jDjA+lS+zC7AoZfMHx1pHun7+TThl1YQwlqcQarnhC5Bfq RYq+IzB4klRIE0BsOxCFgp4ytWEyaaUKVq3LegB4fqEYX6jqD5YBI+FSNXWswCBAdgi2UC 1aMyj4s+bLMhYbdx3s2dR+dIlJkxJKo= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R5WRB2t8dztR9M; Wed, 19 Jul 2023 17:55:50 +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; Wed, 19 Jul 2023 17:58:56 +0800 From: Peng Zhang To: , , CC: , , , , ZhangPeng Subject: [PATCH v2 4/9] mm/page_io: use a folio in __end_swap_bio_read() Date: Wed, 19 Jul 2023 17:58:43 +0800 Message-ID: <20230719095848.3422629-5-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230719095848.3422629-1-zhangpeng362@huawei.com> References: <20230719095848.3422629-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 4342B4001A X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: kmumwaxbcmjtntspjca3nmc8gjrt8c7t X-HE-Tag: 1689760740-674560 X-HE-Meta: U2FsdGVkX18aO5df+6aMQ/XEoZ7RaQX26PRLTAbW8ts0OYl2H6D5SzOp19YLDYcL/rZelxrG9DnHRxQrBYTALf6viQYhbfMS9xMOQdO022Nweia9EzHu+Sq03p6DNoYjWD0MDJUW0AZURiUTSnE6hfydvpgJ+qDtoc11tLxZFkwjEgjQ943ujHzjVr/0ix73SWh+SMFk1kKfR8Z6Ys7BQzkaKGmiK4aU3/ScJeSTH11oui/SrROIhu44ODw69ImpZNkjXxu68nU8ZF0HgLkfmc7AmVOPHqzlU+g04tXc8xNZ99j2SvSzkYQOhisAcju0O1nPWv3B6FRypwW0Xrujg88Mve0/a+jWondK/RoBt1viGsz7lQlgxkL3sau/gj+OLi+gr3BfwMc/KiKCuVjF40CctmF7YDhIvJILKv1WClV2O/YF8lzRAkCtU7BIxjVoywdRuEDEWL8LboDtSJby2dR/saBJ0Cuao6snwZCc8OvgzJsJYq6UAI54sDE6GUkdfoYn9T94cQhxo3DAfib2qOd9FzyIpONwye9ggYLwuYGohf45ILc759Yspfmp6+PjjhsE74sE7SKgAIQHbSTuY0se4YJld0OvoLr+ggC5mRMteiGgALIsKjFmdeeFjDERxXCNw93Y+dF//W1EYcZ5twpkDl13zUs6UL9u3dcNDtkQwLj7OcgUpnzmWHyoVBsabNZVZaulDvcqtlTYG88nJXSPOXBei2PH7VW7prV2xU5BfFFPL7rSqLGd7nemfsvnzzXTKcJjv5OuKawCKRRTDGxZgtPkWfDK6GYbzBZ7SV8yhuM2bVuFcOunK6XyIEMXKK62khsaXqnzux4xIfYdZrAzVMwdtwQgXlkFzInGzvBpmmbTL/PnoOuqHEHvEWxoZNHt8vZjoy6iWr9cOUkg9A9ZnVaC+q9UmYGZNIT+xmQDPNdefSqPLplHBted807arURF8t0WzIc5hnDk70T zSt0kokm K80Ox7kNchK45fIGmvn/ox9PUiZWB9YjRYvzjn7tZMIRoAt5xq2/CZOgse8ohawMBllENOkq9RJtuuJPksqXdUWkJnK0X5fLT3VZbx6pk6y5CWeWjawlmNKYDkEvI3crVmUNCSFW0KKMxgbigQPvXqZMcrUOYxo624jQ92I5Qs0M/EmYapk95G2u6Ej+EE5t9zneY 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 --- mm/page_io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index e21d570c873d..6520687bd282 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -57,16 +57,16 @@ static void end_swap_bio_write(struct bio *bio) static void __end_swap_bio_read(struct bio *bio) { - struct page *page = &bio_first_folio_all(bio)->page; + struct folio *folio = bio_first_folio_all(bio); if (bio->bi_status) { 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 Wed Jul 19 09:58:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13318703 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 9BF17C001DC for ; Wed, 19 Jul 2023 09:59:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C79ED280046; Wed, 19 Jul 2023 05:59:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BB388280045; Wed, 19 Jul 2023 05:59:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 98F91280049; Wed, 19 Jul 2023 05:59:04 -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 71F01280046 for ; Wed, 19 Jul 2023 05:59:04 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3A3634020F for ; Wed, 19 Jul 2023 09:59:04 +0000 (UTC) X-FDA: 81027913008.28.4059647 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf04.hostedemail.com (Postfix) with ESMTP id B1C4F40014 for ; Wed, 19 Jul 2023 09:59:01 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 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=1689760742; 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=7iJ8RQalvU29tR6/0DVQL0+l89i13Wo4PPDJ7dZu1gI=; b=i9g1GHxGaLdZklhSSxRHEvIZqIqfyz3AVDenwWdpDwT/WEYfmIK3WpvmCDGDf5btYtY9Lo cukQUHPPvcsyYmTv+mn4HGcnO8cIh1hmT5L2Lgxje/a3NTLf9gfyH/+Lxur1ceIhRc4juv JraGQDoVYnmzDq+sh7mwT+JV54JXbuY= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689760742; a=rsa-sha256; cv=none; b=hvtuxP0+SRwJV7a6fYkCUmVFoo9hYey6Xu7Aml/ZFNkheYxP80gqYziEJPqmfm+tk5/bZ3 v8wsQmaaaEYmlgkII0D3KXi9ln5X6/0FpSTeXdIUCiw0GaFJB6mcxS4ge6WBGpUmhZPooA rRZByQeAABIDp44Qe2Xzg5SOGCFWHl4= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R5WRC0MkCztQlV; Wed, 19 Jul 2023 17:55:51 +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; Wed, 19 Jul 2023 17:58:57 +0800 From: Peng Zhang To: , , CC: , , , , ZhangPeng Subject: [PATCH v2 5/9] mm/page_io: use a folio in sio_read_complete() Date: Wed, 19 Jul 2023 17:58:44 +0800 Message-ID: <20230719095848.3422629-6-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230719095848.3422629-1-zhangpeng362@huawei.com> References: <20230719095848.3422629-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: B1C4F40014 X-Stat-Signature: hjpkuweapcxb7jpq8nezpbuqqbagu1e6 X-HE-Tag: 1689760741-268239 X-HE-Meta: U2FsdGVkX18joMV0PqRy8BLXJCLSb57zEYKvNv9dDwfxzOspkVWdvER8CT5yi/2EQ/O2TlbqqwgpJTw51tRvw5mSmtxjj+cAoOe8VyqrKkE0uJVLF22mOg/B2Vy9r6Qia2AKQ3OA6FwHry56yI6oilsLpifyVA2SjqJNHBggjKMayi2UDtk3mr++s1noztEzb9ECOiq66Kfo92QM67nDLedLGaGWfVqdngN9bJESSv9qlSQFWTmIzLd0Zxm2l20wotUuLkkY+oMxozniL95N6en5fbGFVFWrzpXHxT3fsfEID1eRhNWc3/9dcgMF6bLjpBbsd5Pb4EmdDsHAp/C/Zz6EXUaDA4tz6AbYSes18+Jq7H9M1GLMAaUnZdThl9wJe6Mr7kLbWeNDISzh+p+2iD8m6jbMdR+0EpioY7ioPaahq7fkO184nCHBWMKykmJGJQRjHy4NnMj/wX4PSQcl/JEp9JjAQXK6yh4Uki/CxzOO+wosZyM2W+YY9kwrWA+lkTn0PyCBpDz4CRympXmtnSzoJP+11LDE6OcWCWwcgW7dUMpbn760sv1dGUUNxgtSKVCVhTsDv5xfTmmCkWJQQXjZiSEfJLEmv+2dRBzmaEgFsymckkJf+UqwE+YFflJWzwNVHSc4GbEoseViam7mbx3yqtj9umGw7GNxFmEnSpSUBBsl4WsTMNcx88rxLntELo7I4oWKVKktuV+Pmo1p+MY421ZCwbZlJRdApIrpUo9Iv8X/peNYqDKb3SsHLhzJujO/KWWncnw5v91vWzI5I6AwGZW84kIqVWtoMvGw2MoBVWzSL0IJw7g3nI3XQGy8G71e04KRUAJPfZkIlWa6WDO4+ki7qVUFclXvzSIhgIASJ5yJmyb79fvPoywe7RMT1oqeqQPcJovsM6w5uWolDgAGc2ol7O2UwvqLECpUh1aE9Il9BrrelnrN5h0PqT5HBwP2iPIhd+6sYQTZu/o eBLhXZpq inr5CzuZYJbsTz9nWm+0472jXPDFkcSy1/+FqTuOuxe1kAnGocmtv/s3hvysQVJLAZ+14nJ9I6vQhNiqMdR0T5sZPDmx2T7EI2Rgv5NjMiqEOyvA6f+frfxLmlLfIA5sbAIUwkZ7ofc0UuWto1dxYck3ChGfx1USlCOKHthKR6T5k604K6dohE4pxFyRL/FE2UGTT 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 --- 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 6520687bd282..92f21f380ee8 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -403,17 +403,17 @@ 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); - unlock_page(page); + folio_unlock(folio); } pr_alert_ratelimited("Read-error on swap-device\n"); } From patchwork Wed Jul 19 09:58:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13318705 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 5F6FEC001B0 for ; Wed, 19 Jul 2023 09:59:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC3D328004A; Wed, 19 Jul 2023 05:59:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E4B70280045; Wed, 19 Jul 2023 05:59:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C774D28004A; Wed, 19 Jul 2023 05:59:05 -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 AEDE3280045 for ; Wed, 19 Jul 2023 05:59:05 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8203AC01D5 for ; Wed, 19 Jul 2023 09:59:05 +0000 (UTC) X-FDA: 81027913050.20.818A500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf24.hostedemail.com (Postfix) with ESMTP id 0320B180005 for ; Wed, 19 Jul 2023 09:59:02 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; spf=pass (imf24.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=1689760743; 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=05tbuRnTFRinPzP93Bz+bXGAm8DHGnIQ7HSd5f8g8RQ=; b=VNpoggg6KkQ+k5SWxOukgf30KFsMletuPfJEENgoU7JukWej9rz0vLSrHmLezfc+p4dTHe UYI4eeeuaJ0DYgMxVQgLpB0mBlXjNQ/2bs6epm28SYcnmtx5wWbtTr8wtQQrwamwCcu8rr ufokL14+RDNr4QHm+zWSOKQuzTFpG4A= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689760743; a=rsa-sha256; cv=none; b=0fGIJmPEbQJ+EeDlHj//etr5VG7dQv/1sahCT2TjKROK4KH3y/57K6wr7ISuXUMHNIgYyS 9zFW5MsImcembP0udmr7GzhyDzQ4f7iBXpk71U5nOL88GQaRFjYFEhYgO00IDOezvMdjNY vN5OIdyF+wpiF11UOV++lxk9twGaQHE= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; spf=pass (imf24.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 Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R5WRy72ngzLnsB; Wed, 19 Jul 2023 17:56: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; Wed, 19 Jul 2023 17:58:57 +0800 From: Peng Zhang To: , , CC: , , , , ZhangPeng Subject: [PATCH v2 6/9] mm/page_io: use a folio in swap_writepage_bdev_sync() Date: Wed, 19 Jul 2023 17:58:45 +0800 Message-ID: <20230719095848.3422629-7-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230719095848.3422629-1-zhangpeng362@huawei.com> References: <20230719095848.3422629-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 0320B180005 X-Rspam-User: X-Stat-Signature: rwur6uqxu7xp65tkd6b3crukrtg1oi6h X-Rspamd-Server: rspam03 X-HE-Tag: 1689760742-785173 X-HE-Meta: U2FsdGVkX19YpYY6yo7xNLjtvhTd6zgMyRFNiLGptN9YjNO9aXh8hBNkzqOfwZ6WT1bcpnnvf1MUZY9ZXENdwWTKQny1XMl1AD48733oFyS248F8llAHifJpxxn/3p83rw1EtDGqoVgnstj7mrL/69jeKxPoMY9VTqNq/D9lo3hhR6/rOPonZxlp/US4tOpzsoRIvwrBBAgleiIw3wh2/jkYoMdJ9381kgq3UOkOOaVotl0DLtPEVsFI2vldoICJpozTkuo2gJ9AqxnEu9K4TBrVq60xHnnzlAbY9CkRysjUDVw2rPINBDwC4vjPswbbD0CunMbCMIMXJvis5im6J5rS9pC93hbiFsLiP3ggfq3jLepHxnZ7/PL2eNUoSgExYlg7H5GknS3nO9Fm/k8GEKG+0U92yx9YRAtDziu9XPW6+akmp/OpUKvWZQAjJ1zckg5FEjh+ppwp8vrYnGcD8rbbnZ/WVYXnTxWLuYXvqgowhtTCGPmEzmltsnChBwSZckZal7V6tSlhZGSPWRqPyMQxVwBDn7tNo/TR5QDehp893u1/drmSnwyu2ZOKSYlKAZm4magBfy9IPqSY95JtdSpD4E+SxmeQ3ZWpEMuIxzyNDqsYm/9R0tV6xK9JTyflZPkbhFlF1J1/JrGcaisqj67shH+NhAJijYv7/UI6SR9Id1/6nwHXqHRd9fJOJeOMBJ1aHHp9Xx+Xqm/0mu5A+Ksl9WJahryvTTyB1jsBnXo2ewO622WTU/CICqDhpKh+D2n4g2gtOZTbT1D+mZNpOzE0GLZ9RcSY66I95UgFsBjXAewBT9PBaZr59elQn+sHUyGdjZbdWdBl+W/FumwxslhJ/9+ZInnlovut9h/BAJy3VfZBpztuilA/ytvRrj6mf0PZYe0Jag9DJIRv0SM8chg30YHP/cVwo61p56QoWvJxxOcHtyBRAqqAnOa3kn7Vxq7h7vdrpVtTZ4eCsH5 s1JW3mtY H7guD5uvH0sF/oOsjkCEJXPHXEZx6XeCJj1IxEm4d+tg7wpudjMjmwMYRcAmn9A/JhpWHYkflDLFXiCkEqHCKB4xsjLhc3G9ldcf1DJp04rVlwEXx2sxz0FQa2Q97SXA7oDtHTRwY18hYontmpZOkj5ZN7k3R5n08hOSO5KvwWkrogJWT2NeL86fSaRuNt7klDACe+Bdac1TQk1lwMGfcDlbDmO5wC/O5T6TOWDBFwSnUVvZ+BSdZsEZpDw== 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 92f21f380ee8..0c96ea9dd258 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); From patchwork Wed Jul 19 09:58:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13318706 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 5603BEB64DA for ; Wed, 19 Jul 2023 09:59:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DFF4028004B; Wed, 19 Jul 2023 05:59:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DAFBD280045; Wed, 19 Jul 2023 05:59:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C4FE928004B; Wed, 19 Jul 2023 05:59:06 -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 B6E53280045 for ; Wed, 19 Jul 2023 05:59:06 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 87D8EB079B for ; Wed, 19 Jul 2023 09:59:06 +0000 (UTC) X-FDA: 81027913092.15.6F23F05 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf27.hostedemail.com (Postfix) with ESMTP id 3B3E540015 for ; Wed, 19 Jul 2023 09:59:03 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 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=1689760744; 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=UVTGk7uE48dHWx0qiOUJ1sysC+jsNAeG55w6ywd1FnI=; b=fxJrosnexVfG/QSqV4ADVkJgwxnHl23dr/7TfSuncPLGTpSW8ZdMiAyN2I4otuVQC4Ovp2 M5qcePsFp+ZgH/Y4NBKO4dAHdn7PrvKVTQaOxGg3GAPWS2Xga7lO0sKxnBxcoq/WUMj7jm uGpDsRJC+HjDJT1BBDzTLQrk4Muh5xA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689760744; a=rsa-sha256; cv=none; b=uoJbA3YA7T5wZVU9rdlOq7N2bevkc+jWh3+nw9DWBPww/AFFeakZYadRSl1L1RNfjBtLkd vKKuSUmdq9Qj8MZBkOMldz3UAWC+t4xvY1Ig20UPDAfT1H/s3LFWy5i/FuvtBbMMN/JhEa YMhmbxO60D+nBup/PHS6wwyR+FaT/ok= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 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.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R5WTz42kTz18LrV; Wed, 19 Jul 2023 17:58:15 +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; Wed, 19 Jul 2023 17:58:58 +0800 From: Peng Zhang To: , , CC: , , , , ZhangPeng Subject: [PATCH v2 7/9] mm/page_io: use a folio in swap_writepage_bdev_async() Date: Wed, 19 Jul 2023 17:58:46 +0800 Message-ID: <20230719095848.3422629-8-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230719095848.3422629-1-zhangpeng362@huawei.com> References: <20230719095848.3422629-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 3B3E540015 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 3zciibjs169wcd77jde36hg6bjcmw7x1 X-HE-Tag: 1689760743-434547 X-HE-Meta: U2FsdGVkX19Mm3fjOFUGxP8PtNdAYnI/ZJx8ZE9lbZhDxt+2OhPlgN6NDvcpCNGbmXcnvb9VyvsqahZbpvH7gYA/nVXARtD2jw0Bb5LpF5ekiqcBitYtpdk+NNqB0kp+SE7n6bHG/Zm+m5ERu6Ox4fxoRpTxe1ffxq/02aG41ZdJzKJOtlMxYAT1nvRY9IMILArI5JzM8VmxuVROpkYhFbUK8QSJPm7QDthNNQsmTOk3vjs6FcRq0AVRPtm9ognBO2ppgh5ZGB2BedxJJ6YetmNI5O5AkmjeM5V1gdyhVV9YSiKFbS9D2ovcx1uwSs0NPkdxT2ptdiCJtREveFlZ7F4bwI1CBsIpauckxGUBfO7HzRcKlKi1Cn/F1Blf0Yd1DtODp58HU3vlsxmpoAzbqmmNygIeUg5XtXEFiYoaZerXRYHxpSwmk0qcayGzi0CEQ+cewjSWQDEE2jLsc+UHlmXAao2U03Drsng9i8u8Clr/LHQAWqdXAkDI6h02j3aBts0zeL5yro6jAbLmFaQOCzmoW7jwbDp5bqW6b5YGBerlGHXpOi7eWmri0RXN3LeD/cBoYQrTMzACPBz6smDgW8LhSnzK5O/ZnTHBSwczMdR8tkZUjc3VyNThKKaoh6fIgu1xX2C92wA185AGF4MA0DoE8IRF12ZkOZqeieiEwP3TI1jhfjbowM5d95R8B7p/nCTznoN0O3hM9lhtZbD6oN9gLDiNvgq2UuY9A+tc5MjM13sJA+NrhcsVXiqd3uOy/E8qFpoaaMxjzJL1g0+F3AP8hUN7Lk6BVQ1bP99I/3JwdqOryuXqG/SWt/3FmJNhuVz7b4dXGpT9YLmECgrMFy2qnlzqWVSSWRCS4BaGTxcdlb7CsuKXGjqOFOyMVF0YMOmqobDrSjKzWOX9ARl0YI/du6YklKtwjlXWFgv3MDv0osAtAZX5T8NazL1jRzBGCFfsiTkskiKnqrN/Ddv FjujluET wtoxSeFrW61wch5gRGlZXUfaQmwIlDw1VBMtvQ52YoYEVJAm5LQJrz7Uj09Urh2iDgM8P6wg+Hv8THBDTZEE2+WlUMo/Cx2Yd5VfOBn8PUOkGseFdSt7LjNoRCiOqNAOunFd+HIhQfi1s8HGdppt4oJj6vpi7E3w4lxVljiXFHPi+Q2USrzuEiSrCuFVfQiaawgu5v6Pknxs9fcZ3aDOYVDUFhHos3Tv1DmmGENJKcmS4CVqfnyoRUp+uEQ== 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 0c96ea9dd258..e28395331bb0 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); } From patchwork Wed Jul 19 09:58:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13318704 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 7C9F9EB64DA for ; Wed, 19 Jul 2023 09:59:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7E42F280049; Wed, 19 Jul 2023 05:59:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 79568280045; Wed, 19 Jul 2023 05:59:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E7F7280049; Wed, 19 Jul 2023 05:59:05 -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 4E683280045 for ; Wed, 19 Jul 2023 05:59:05 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 292E7C01A2 for ; Wed, 19 Jul 2023 09:59:05 +0000 (UTC) X-FDA: 81027913050.24.A28A310 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf09.hostedemail.com (Postfix) with ESMTP id 02179140009 for ; Wed, 19 Jul 2023 09:59:02 +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.187 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=1689760743; 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=h0zgsx3kKMFpGJVNCTy73NxTaUsiGD9mJb5htLkWjOM=; b=wnUlkGNR2LbZABh8sNwCEAHcxWC5wcTwGC/obh9MOArfpdu891YXSDC29xGXj/KZJt/o5B hCWfwVP7PIW5wfVfXK5yONnBirPyFmlWpOpM4RyAzytGqKq0McLCrt5wZuoxlrhVBLjNPV 9twBPcWUV0bsSQpQMqFnN7ULSBd3pZ0= 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.187 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689760743; a=rsa-sha256; cv=none; b=oaWAjVoHZwnv4gJOinAytFwFfjkcK3dj157ZagVzd3r/NuhS1UgjImyF9WGKHrk3jYpCyE oZQ63QP9xM7Ack6s4OOHhtmzUr7Ydhy/c0gwqLC4/4KPdDISm2zi7KBiZO6MrJv+Pzw+UP I/SXy+mK/Dke3H2A+PtHUTcX9/HelpE= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R5WRF2wptztRbR; Wed, 19 Jul 2023 17:55:53 +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; Wed, 19 Jul 2023 17:58:59 +0800 From: Peng Zhang To: , , CC: , , , , ZhangPeng Subject: [PATCH v2 8/9] mm/page_io: convert count_swpout_vm_event() to take in a folio Date: Wed, 19 Jul 2023 17:58:47 +0800 Message-ID: <20230719095848.3422629-9-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230719095848.3422629-1-zhangpeng362@huawei.com> References: <20230719095848.3422629-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspam-User: X-Stat-Signature: uwnwew17kmmif3mr9bhm7jzcys83sb1g X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 02179140009 X-HE-Tag: 1689760742-422959 X-HE-Meta: U2FsdGVkX19Qe6tvnAetdnNrQZmZNIJoxaC5GpVF8VGYSOxaYA/3gFSf5MyBMLLnqZQkuF+gWm1M6ViM2Y8ZVvAgnXuaLaW3KDRm6325xbi5h1bTJedri3Qk0E6OC35Cgdc8GACfMduZ+gJ43O9oAsnPa4lPbb+S+0IwamehAPbJ5lnMJFSBTS8bvmSqPzQF3uMRJzP0Jy3pwnIdWgn/YnP+4MVtmmElGURERscekdTGZ413OHa2JuIUoPiK82I/BYiNSUVMat3RSgJ0L7JPqC1+qoANr+u0trVxyVJ9SOvtp95EC9CwFN5Jj60LB1+rti1IVp5tHDOXYL0+fGbKgWOBig6bIfPkhlIuqSBSOHwbKZS/QGnJgyLTfpNOflHAnLTQz1E3cicN+/ghFhjssjHH33uoGoQtmi2BZw/B+d5tVnvLMoGHBo2ENYAfIVjy28HVAZj0DCGdSrnDdSJNT0D6cEoc5My6TMgsQfrnZpUdvOS0PvDFUcxCF2gvYJ6omVh7OyYh3UJsx0W/rp/dFpcYVqwyQ8fE9XPFgQUDEDPEVWgmf4T3tTYK9/NjoUiFLTr9lOZlEJkWGS3Lyy4yCtGWlud2xr7wa9vBHHJfgKjb9hvJcSIXtZtjYzBOlpi1izWRBZufRUKQj1Ikk/3Q7atFydsv0qwW49jc7UxkwUDO10jIqwsnTCd/ZRdU1dPvzA513cTj71mIBHvOwm0LqnzaBXqUS+tIsL34Zxf1xeMFAz5jNWOo/RHipRxN9qNn198oBAnXhILHPwi7JMOxLjnWTU/9Ytw82nXNipBpQA4B4zIC/xrShdsYe8HulAVZPX9ZeO6HcksBy2TviqwyfboE6U8pCJSIr1RBDxsXfwFGizIzyLVjhZh1Watjocyun7S397IeIO464fo+/u1r3nJ0QpMdvUy+h613tn+uBoArnoIaUtSyxig/gO1w8UZ9BpjqEMPhLUT5mf+EwKs QcPexjw7 dNrJwBhNigf7Flc1sYlB/UVFQzAsggPMwEESddJA5wUsgOhtJgXHlCsUN7AIPHC0rTNcWBzghCF5SLCJ7WxqBH2NIslBP1eWdGPSGcW5/Ge4lGQevAnMcpWnYziTEEbdSyC6YnWSJ+sivPz2mc6jgeLYEgD5aqZeeW08GFJ6p1fRelPlopvOE2te8Agq0UrCtiv34 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 e28395331bb0..fa8caf1c05d8 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -205,13 +205,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_pmd_mappable(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) @@ -280,7 +280,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++) @@ -339,7 +339,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); @@ -362,7 +362,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 Wed Jul 19 09:58: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: 13318708 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 D7323EB64DA for ; Wed, 19 Jul 2023 09:59:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5E91728004D; Wed, 19 Jul 2023 05:59:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 599C328004C; Wed, 19 Jul 2023 05:59:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4396528004D; Wed, 19 Jul 2023 05:59:08 -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 343FD28004C for ; Wed, 19 Jul 2023 05:59:08 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 078758018D for ; Wed, 19 Jul 2023 09:59:08 +0000 (UTC) X-FDA: 81027913176.30.61B7B56 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf30.hostedemail.com (Postfix) with ESMTP id B85F880014 for ; Wed, 19 Jul 2023 09:59:04 +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=1689760746; 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=UNTnENqbVIYj1TRfK8rpAxUpKqIh0BpIcBiqRUvXjmo=; b=TLv/6wOqKUqDLxOnZdhxpPlWtqpSxQNL626Zox5ayy19RD/VP/dEZcR54njC06cBCVKjTZ kFTtBITNTKdZDjZIX/iJoOBUxPPefsQBuubgJGoGE4sqVTohtxlnOE3erVLcspDAGP8Roz zKhhtS8Li8OFvZ9Tqc/Ew32npoP6kUg= 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=1689760746; a=rsa-sha256; cv=none; b=uuJiyTvaZ9g/rpbZsEpImkhzwcXlyih43KR/BUB11V6gy1qd7yGkjAMvm3rNMQIF1B5zRf MRAFhHff9kZclhQY2zs2AYASxBoOP9njlv4oDLrYZdkBFlqRnBa7Yt84gXhP2+aq5lhaIf CFzrufSdTSnBdGyNOHfHnRl7yMAzzZA= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R5WS1161nzLnsJ; Wed, 19 Jul 2023 17:56:33 +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; Wed, 19 Jul 2023 17:58:59 +0800 From: Peng Zhang To: , , CC: , , , , ZhangPeng Subject: [PATCH v2 9/9] mm/page_io: convert bio_associate_blkg_from_page() to take in a folio Date: Wed, 19 Jul 2023 17:58:48 +0800 Message-ID: <20230719095848.3422629-10-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230719095848.3422629-1-zhangpeng362@huawei.com> References: <20230719095848.3422629-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: B85F880014 X-Rspam-User: X-Stat-Signature: oh41h8apdggh585349rrsqexyh5qit6e X-Rspamd-Server: rspam01 X-HE-Tag: 1689760744-106704 X-HE-Meta: U2FsdGVkX19DJVYq4XZenbkcY4Nr4ds5yf7TkK7Pe0+21/6Ee7yEeRj3AKVE3UHK2G404GbPMH/nogU8eVEmjKgMtmWY4E+qy6aJtDoYURBG4oobMapb2RcjBBv+pBb662ZYIWpRgOzvGdmTejf4vzZ6OzSaYjpiUFarHefHEAGSJFkvueV7AjuKsAwa8XRLF6/AOsOdYplREYZcOfl/g9ZI9sl7mdFTyDqjMELm2O0c8k3ZPSL0YqsjzTWklQetwj9vCo4eWw5Fl4SHH0U2HcX+AT9FZj/whuv77EgwJ1CeFLlfaH9ijK1hiPkbySdWdyuw/S+GToRUmP10z1IkMBd/uUlxDXJdF7stCWr/BQdZbWUYx4EBobZ2xddqbM/gkUZAu4ROyeHURG+h/07ObG9w/BQdZ6qy4VeY0EB2hWbz+dmCOzMjRROjHubdZbGMZ2A4yypq0zWkrM0Le5Op4Dq9I+bSwMQtYIDIpcYGLve9QoAQH1k0B070AONA3aqSNx4dDeBarqfMJMWlMy5IoTvZQZcPREETjy8/o1tD4omvjhCOilXKM68E/hDZ5ObzaEumz4hmftT9mTLASIpJbsGdUI8sxiz8XNFZYJLQ5fO9gWChGxZOaPyrSo9ygKZvdP3XDLY5djcBVKecERec4HwU67EsYT9jQFZzorsF++KfhXswCZobMZUUbBHuWyaJanBhQYIPHxoQAL+2PluVRhbiThMlKS2TsZXqT+41YczfL6qGbx4zlAtqLFjuLk2nuT83UU2JbG3FktzaUQQl2dfFRHeKAXTulB82khl5I7XSrjnvW7r/4xVvSrxUqwG6k9Kyg1V4jFPwPOUGO2xeft5Nlv+m35d+OhwNw5JMC8IMeJsin3d73J+0MAUhVvmOKP7JxhIQ2pwRZBw+qmXpJXWdRF763o1BQRg7fi5CP5G23/7j7M855fT9/cZ3OdW+UtkBBIwZXU+zGpYtZ3H UQOCJvpt VTtFc0I6DjLewwpY9whBTqGIwCXz0uDnsCoCuST8+9hlaTnum5dYWjo79ZDMzekV5TC+4ynofcCvwatoQmAXiKzE/Y2jcdPBFK0hrzl1oiqR1Cn+y/1guE+1baqCP/OoOoS4ZJxh9MDQSkpmpJU9GYEYpKbXCXCx0oBWdFKp3QDcRqzrxdGu0A1eAp8PERvXdjzGqJmPuoM7tyRQ55GC38pZQtLqKcTlAhS9GP4oczt7lvPIEDIJRahr7FA== 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 fa8caf1c05d8..dcb58888dd36 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -215,12 +215,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; @@ -230,7 +230,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 { @@ -338,7 +338,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); @@ -361,7 +361,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);