From patchwork Fri Jul 21 03:44: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: 13321297 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 41348EB64DD for ; Fri, 21 Jul 2023 03:45:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4B58C28018B; Thu, 20 Jul 2023 23:45:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4641E28018C; Thu, 20 Jul 2023 23:45:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1325128018B; Thu, 20 Jul 2023 23:45:19 -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 BB86128018D for ; Thu, 20 Jul 2023 23:45:18 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 820C714012B for ; Fri, 21 Jul 2023 03:45:18 +0000 (UTC) X-FDA: 81034228716.20.E977D5C Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf08.hostedemail.com (Postfix) with ESMTP id A533516000B for ; Fri, 21 Jul 2023 03:45:15 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.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=1689911116; a=rsa-sha256; cv=none; b=wuipYHp7IofKeQISZ2PafJRITNNoNIcoObTxmQPmZwsOG7gWa5zcT0bvv5aX5xVxcGzUn+ EbWAWVbIv36E4c1oROcDbwu/8MgnwUW6uMTZ+3t+5O9jV2iCp2sV+HvngY60td6XMp3lb9 08u4pFd8HuaNJJ0pEwnKtOdVnmYFJ4g= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.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=1689911116; 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=KOtioq36HFE3JLecFRwXgoIZflowynsB5atPBKT0HA473dpLWepD8w19F1duYxUOhy1dEw 06Ct4CiY74FUf7cM+Q9WudpW9Cmw5oHQhb6/YThsyEkQyb01QcIxBhv8i6I3H84YTUPdMh oq5ndVemeNaHxVkXTKLPzHCHJVjhbYo= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R6b5g0PLYz18MC2; Fri, 21 Jul 2023 11:44:23 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 21 Jul 2023 11:45:08 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v4 01/10] mm/page_io: remove unneeded ClearPageUptodate() Date: Fri, 21 Jul 2023 11:44:42 +0800 Message-ID: <20230721034451.16412-2-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230721034451.16412-1-zhangpeng362@huawei.com> References: <20230721034451.16412-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: A533516000B X-Stat-Signature: 7nmw46ado1xrr1t7yjj4wuxh67qjijfz X-Rspam-User: X-HE-Tag: 1689911115-661978 X-HE-Meta: U2FsdGVkX18z6EjAp6CmLRztFUxSCfRGG/PeVAeq+OcAP7YOCSMjr2Dx9a7DCP4+L9WCwQlDl1w1twAC76e+G7l4WlU4R2p3uFEpyGjcFrwtTdM5CrgnJ7S5NPO+UidK207ZSZGufSIOG2RjOCT72EEq9sMQfu1h9bi2LLmWw/0y0PB4Hhy53wmhugWNmynOo4zddKyvUdYYDmmGS4GfMj/9Z9F3lYIuaFnygJ2dLrLISmqleubWmgO3hvl+fLGaXq6dDPWAOivBThSpFscvGvwieSUWgBCvpS+Fqw88wWKGSbezG9QGTII+YhZuLDThQ7IlVoTWRZ0pCUwd1TgzTZ14uJaSoduoddee4cSsZiJ1fqlPSXjbqXxb1yF/EB+pe3ykoTrzd+hSgdYC9a6mwwAGLdPp0NR/ibxKTPdARWnm/xPvq1Yui7H7vD+JyemBwhHgeL0sq/qCbG3YCL3fazZ+9hdH8kvkPEHNfRKHp+Vk/cLfxAzEma4KthX2w14mpJFx3yAjRkQLB92TrRC0PACr2rXW3/JSubiagh1+btj6H4guFRt/zDSTvISKUzHqad83OO+YMhsn9R9jvUyLsEIjocQSUQnqE5gh47yyASdD6VRcq3JoLIRQt6pOS8eR5UbHYtxJ4BA1MHAfUrI35+tEurZo1JdHuF1jIv77zQtW+ku3ruSRpUSaRBtMOdITaFUCWMe0QcvKiG0SUir9prZue6gr9S/5CWTk43rMg3LMwjwdOfGOFVnhwTsIu4wZ+MQGu95OVxC7zSk0sr/uakvck+wo8LgFUEESc2Rs8YDoQJfVNQqaxQA3Hf/jgab0TX3sp+dMvOlAI8WseAK5xQU3+6Do5U/ko3kpxu/Gm8srr+5ynMBsEx2q1QGPph4X3urMNmJIDzviw/9KIFMaleN82zWvs3PqoKvZDF3O7PKXha+9QdYIa6pgXWJJDT1HpFozmKrgdLwCqOQ8ZMR BisKA+iD CUvKn5Zd6WhP8rW3riAMVbzEQLuZI//WS56repnGrU4MZuEQLxjS8VIkVl8GbFdWRBOmYNb0jfw2KvqF04StRvGCIzKQQ2LPufvPb84T6OAWji3iynQCrVIUpjlh2Gu3TC25JXsk8bufVre6vwdFHWYkMJhUuEe1+QOMPV/CLRuqUWQtBPimdeHjqME52k406Lro7FaDRvkK1Wi2PCj0bfH4SujiPEoeLPxggDrB33Kg+vW4UyOABhxVJaQ== 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 Fri Jul 21 03:44: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: 13321296 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 47835C001DE for ; Fri, 21 Jul 2023 03:45:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1F72F28018F; Thu, 20 Jul 2023 23:45:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A6F528018C; Thu, 20 Jul 2023 23:45:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA57028018F; Thu, 20 Jul 2023 23:45: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 B2E9928018C for ; Thu, 20 Jul 2023 23:45:18 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 5F61B80126 for ; Fri, 21 Jul 2023 03:45:18 +0000 (UTC) X-FDA: 81034228716.26.B0C53EB Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf25.hostedemail.com (Postfix) with ESMTP id BDF64A0008 for ; Fri, 21 Jul 2023 03:45:14 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.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=1689911115; 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=IPKycK7i1oEGmUkNrbIQU40hyIS0Vpb9DdVhmnrwwqFiItvTuORrkDPH/Iu/2PKOmPmKHY uTyXaBOjQPeKd1+Lr8RqiisqmoAcUBvN1prcwCzxWOxnTnBnA+V4RsgJDHLrFGbWBFwXUA 8fYJ/IivVUY7rJ8cYCLFHx0WqDhKRgY= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.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=1689911115; a=rsa-sha256; cv=none; b=m1ZP3aljXw6nPoca7lSU9W2v+9Ru2cCblCgRVQ63MzPwGyMVBc8rZyByoywZh9i04UJPei UMasVCdIp6w2w7sWnOzgH1ub3tU20goB4FW67hJ020IDQCikIqN11hHbDnF/U1ZD7TLoxo DHasvQYGHEt5KZMkCvhaTE+4lq2a834= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R6b2x0j9XztRMB; Fri, 21 Jul 2023 11:42:01 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 21 Jul 2023 11:45:08 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v4 02/10] mm/page_io: remove unneeded SetPageError() Date: Fri, 21 Jul 2023 11:44:43 +0800 Message-ID: <20230721034451.16412-3-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230721034451.16412-1-zhangpeng362@huawei.com> References: <20230721034451.16412-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: BDF64A0008 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: sn31i89k6jsagjoh5ekqfjue7pyqwejk X-HE-Tag: 1689911114-952225 X-HE-Meta: U2FsdGVkX18JCV1kBmnp1qBAYCCAK1cMwh7+AnsISQmLydapAHGVpeyrLDHwdEvp6X/FQL1Nnyk7KEKyFhqfjqZLV4CR7gCW9QfWzCwhNVEzl4G5GhQiIT7cqZQTr1vYAwzHd1MRzBzR0Mqgx95PYfsSvzVpZE0bp+qhiVnrhPFo8a29sQ2Vh/8jZCJZAQ+ctdASiotUdKBdm4QZ3CL3ZTdHCalWmokDXtfAgtPJLh5/gU2mcOEKgAILKe+0lsTo/2NR/LM08LXQO21yZdVEa3qco2gvL2+sfkBNaJidn+CMbu1egzOwKwjU+N1oviSyU2orS9aW8IE6Neae6l/aUplh9iDNen78kb/SMnhIQ+5HVGVBbEyyMyg2UF40QQuw6l/E3CS0QjOr/WRQ5n4B92RFo/glIDn2C6H2Y30vfTmXLyD/WZPl7tRxXBYO0NdESEUo6huEWI1tioraBPsG1soQ9o5V7XgLcRkKGVsSMG/3kGGNtjxA8jNPbR8u4vb/2TDbnAJSIGZiuwXF5eqX/tC4f4MYZBwMvSB0tqfFis7/fuFBPEiq+kX1dsvd/h6fdPbDMNBJpYRwI9cSg9Hw3+T5jHWRHrEVaSWTzAWHAuS737WHb/STJk/9V69XiabczwbiRHOh1M/I8ycuOsjthrbsIPvDoGV4/0NKuh05tIEGHXbrgwuHJdCaXqPgJMYsXuB3Ly0rUv8O71GmK0rr4NVbiqtlqblLxKzhBN3quwkKM7UbtKVgi9ixxrB1JQ27DdjVgDB1mYBof0n+VIZSuceoomawszu+vh54F4ZYWGRykgTv0zvJzkDKX0M/RPjcDjeFf7xDcz/kr2HiRgNY6MBdxta1dR0+La9UlVQgn8znModCFuNvr4ahKXh1W5y6loSiNmtNSKMvZ3kva+isyxnnc4tVJ1s28S2jyp4QzOSW+4ESamqdIWSoXnTJFvFOIoRszF56d9heiimoj8p 7Qkp0pzp 3UX8HJBlNeBPgoTPw2xUXkgAUWZ3hQBe1xQSvIgz1Ecaj1oAjsoH0oI/ArFv3JVMxAHTPHu/rZEpRUejKrP12es2Eby8AjScOte13uUDMSXfdbdVFfXB3twVKNb94Zu7qSmwTwpfT/njJWVSeiiUahJbq+YdKRuWtxTNf5+hJYAYOjOMoYAVhWmj/YqhLfxU4kSpVycP/vatnehsmylU6vkxYFvdB/iPX3p3ll4WTEGcogd8q0GKdsjDMcg== 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 Fri Jul 21 03:44: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: 13321295 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 E4531EB64DD for ; Fri, 21 Jul 2023 03:45:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C3AED280189; Thu, 20 Jul 2023 23:45:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6192028018B; Thu, 20 Jul 2023 23:45:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 385C8280188; Thu, 20 Jul 2023 23:45: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 0069128018B for ; Thu, 20 Jul 2023 23:45:17 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D244F80122 for ; Fri, 21 Jul 2023 03:45:17 +0000 (UTC) X-FDA: 81034228674.27.0ED33FB Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf23.hostedemail.com (Postfix) with ESMTP id A3ABE140010 for ; Fri, 21 Jul 2023 03:45:14 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf23.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=1689911116; a=rsa-sha256; cv=none; b=5kuqzAxgNiW6qg5wcwgCbArvyfGd/T1Smj+aHkRhK2qVSSGsAMB58kaGoca7g1e0Z3POdD 09cwd7nSStHrat2YUQxeFfuOOpRz+v8YT9GgxTuBR43J/n2m1MwLwuAGFZ+KRx6C/s0cTf UYa9TuKjhwhkfKij3rkTAMbh9VFYiMQ= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf23.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=1689911116; 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=8Y1QTHugPEXYbpmyf3lw/Ri5X8PoHToRc+NjX/L8NgQ=; b=FgeFbPdO5qaFPqUNuzYEmMA8FmK5SROGel2ntTFAo1jJ9GQ3TlYM0DlgLOgn0KTeznIUzR 4+Im7UOR57n+Hvq4QJokzRpyH5qvv6xMKx7fN/1RyVwdMKMb/jvH+H3yb2HaTuj/aWOzBD JzvrEC1E52athAZkvS05ivwBimZMeLY= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R6b4w2MtfzVjnH; Fri, 21 Jul 2023 11:43:44 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 21 Jul 2023 11:45:09 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v4 03/10] mm/page_io: introduce bio_first_folio_all() Date: Fri, 21 Jul 2023 11:44:44 +0800 Message-ID: <20230721034451.16412-4-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230721034451.16412-1-zhangpeng362@huawei.com> References: <20230721034451.16412-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: A3ABE140010 X-Stat-Signature: djxq7cg38y1xcp7q49c496aq9tspdp98 X-Rspam-User: X-HE-Tag: 1689911114-615416 X-HE-Meta: U2FsdGVkX18w/fhFgPsnOHpVSD6xjZkgypSS5K/6o1dunWAYpVvkpAcsDVszJ3ztOpBS7c36Ei+4HwBdEBYNvvGdxWbSrV+nT3MvMZEi5+qOJjulWjg+A+qWDvv9zXC5g9q710E+F03edQgRogvJmq70LUj/dQ5b0Z4b7t8itL2fxJOgL9gzOClGwANbEwuWwhZ+pYGpTc15ioGZnk/zEijASKbCMX8B6ETYNibqXbZzWjAFbLykjYMnsMsu0dpi7Iw9s1fr/psE34gIOqufESD9iDPsciQIcUgx31km1xmNOAQbub+7YEqju7O9g2OvwJxnOBQan+qP5UBJMKL03BuROAu+LMN1nUxPrtvuQOymHhrKbkAM2uROdpOGYVYCGBeN6EcykjgVeByAKoSf02J38byWTKFB7jhfjkfWxRSRLRwMvXs9lnyyWFNBqWXK/dLLdWeiHUPoEYM1sOj1imbhw+etRpDvk0BgLDQm4ljHIgkieHildeI9Gslw9XoqkqcMBvrqEr0+HqHtTaniN+LWMyGfcC9aZQhzbadkyBGXWY14Iea6lO8BkSGaSfTF9hwoSmyl/Ase6Zup2KXS+svaQ8KGUhF5ek4Lbk3mcfVOTrm1Vucme93s0KOhD/oZh1CLoQTOOSBHCuenmjsekYuwvXDtrRMhV0lxh0EZyKvykcXjwiQRixTwnaecc8kzpN1weY3K2T3yx4rCeVKKbCumcvQpaUkE4EN3TIxmW/JfAid9Jnx2YGLcGhEIZLod1+H6Gms3jPvCYBcgmnbZcGVCYMzBRyGdSQafAn8BGRAyCqmGkVqA2W8/Pw92A1mfnD9P9nBSvFk63QY7FRBG9j77m/mptv0Ilhy6GswWR9Oj/D36whgk7ocSWk8VzEWPZelsNk4kOwjjCDgYhvDqZabrnaiYL16K37iHvxtEehP3rKnz/+bPIxbCb2OlISRohCy2V/pJstZeC6M1YAN Gtsm+h9c 72EGX64vfRuAY4jsDprcaQwRa9vvZsUl3fq4dGpQcU8JDTIch8tRffmIY3YSeEdfoqH3akgf0nluwXOFEwghr8BmMZ1z/Bu9GeF5jFzjCdfG+4XLOGu1TBQzBQhxeLJT8rl9TwalN4c50VBUODUoWWznwhRF9ioE5Cmz9MT4AJ6LK/FXEl0G97pNuEWeVyiGEWit74s5q/3RNmXReZrPAN/Pk59aDx8DHVdVFRQvHo3LvWRAtDhYTYEjBIw== 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 Introduce 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 | 1 + include/linux/bio.h | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/Documentation/block/biovecs.rst b/Documentation/block/biovecs.rst index ddb867e0185b..b9dc0c9dbee4 100644 --- a/Documentation/block/biovecs.rst +++ b/Documentation/block/biovecs.rst @@ -134,6 +134,7 @@ Usage of helpers: 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/include/linux/bio.h b/include/linux/bio.h index c4f5b5228105..027ff9ab5d12 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -253,6 +253,11 @@ static inline struct page *bio_first_page_all(struct bio *bio) return bio_first_bvec_all(bio)->bv_page; } +static inline struct folio *bio_first_folio_all(struct bio *bio) +{ + return page_folio(bio_first_page_all(bio)); +} + static inline struct bio_vec *bio_last_bvec_all(struct bio *bio) { WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)); From patchwork Fri Jul 21 03:44: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: 13321293 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 8888BEB64DD for ; Fri, 21 Jul 2023 03:45:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 67D39280188; Thu, 20 Jul 2023 23:45:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 33184280187; Thu, 20 Jul 2023 23:45:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F38EA280189; Thu, 20 Jul 2023 23:45:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B844F28004C for ; Thu, 20 Jul 2023 23:45:17 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 74125A0132 for ; Fri, 21 Jul 2023 03:45:17 +0000 (UTC) X-FDA: 81034228674.29.D0582F1 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf15.hostedemail.com (Postfix) with ESMTP id ABD28A0010 for ; Fri, 21 Jul 2023 03:45:14 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.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=1689911115; 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=2wILzb2wdzx6gb3QQe8NCuw5mHGSyWx+uSmLft9oKJA=; b=Y64l8WDpxbcGG8Xry2gFMPMgbpKFAw8DYuJRZiQAZO2hp/syYldccvmfHsse25XgdEO0Z+ C7Fx4NepI9CrhoQAIk+Qu9xre/18Q9Ra13wUsfcA3euD56qU8TVBv2Q5Ym5aLVA5d6IS4L qEUYSdNu9LZY1g52HsAoXQbZv16tZnQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689911115; a=rsa-sha256; cv=none; b=Y1IuwiIHGt3ZioTaYtR4TNSmYxeAUFselQpNbY3Ea6cDKPwUepoDjSSWCInOYFv7irc1RP qWCRy20Yy5H7B2S1faKJwgTEehfMx3A87Ls2fPBmbLLnUhbYclzW3tauKIYD/6CKEZIVEe CB5YF9iRqPUP8FwE/ifVukYvuwleTX4= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.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.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R6b4x0PtvzVjnQ; Fri, 21 Jul 2023 11:43: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; Fri, 21 Jul 2023 11:45:10 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v4 04/10] mm/page_io: use a folio in __end_swap_bio_write() Date: Fri, 21 Jul 2023 11:44:45 +0800 Message-ID: <20230721034451.16412-5-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230721034451.16412-1-zhangpeng362@huawei.com> References: <20230721034451.16412-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Stat-Signature: hwxhy99gj8g5b3pfcrpk3j4q35tfpqoj X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: ABD28A0010 X-Rspam-User: X-HE-Tag: 1689911114-692830 X-HE-Meta: U2FsdGVkX18mw4wHvVIbtp8S3Ju6EvaB0GGV0CScD5zfV5rddKbLB3Kjj+9LSx0+zkz3tfbMIgqkZYn8LPC40U80vIYrz4Pzn8DyCh372VED2+crBkDQxYiVM2pjYsEA1Ab1FpqVzwTwJTQ2RcOzRNzcHlhI0NQlaH826g7nIouQlRqz5w0G7ovjrizuxsac7ckSsdagK83CoI2VA3ccF1UQiH4O8cFKKd0TthH3lUUEh4mihjbRMHRjgiTDEz8SsZutkLRSHMhOeELDcsSs9NuWH813ls+091Q8WoCM9t00AxVgc4bsnLOuneQ1//tLmbGhaPWk++LPgUz2ETAasVMdtsZ+q1te6jeU3QhyMLMvPjY6wsqQ9xpUUHjUzXIfSDY0YTl1+5GHdE4sBBllSRqvSZ4RLFGTH5dFdP3SYEbZXQEqaNKQaXD/tWSv1hz6/nK0KHv4P1dSYn7Mj2q5NIgT+uy5Vv/c/0FPYrhWnYAzpw4dKc9mDQz/vKjZiJvBXwwgk+Wz4j48OLCW9CbW/SMonjgKTGS2X4neyHwGKqWpqlfM4MzG1/XdDh5ysw9cdE3LSLr1eN4VtkWc1aWpXRNAcl9FzORnBfW7+RqWnQPYxlXSAov/kyC3hVHFpTvHoSlhP3nARTJaw0SWKyoyO5gkE6y5hjV22vwrgWMkMRqpCfR7YSQS/r3YCpeS7nLcAAdv9Kiuk/0tUtug3Uk/Mrqdvy4Law77rI7pFyH2/TugelJ6ekGm8T1eCVvDOWxraoQSqzRaK06rTXKFWVyEKa4E6fesIORz9nBhjpNV0hlwWxIKTFlQ6f8z4zdHo6Df4jR8vhVFSrSBU4FBAUqpE1MY6CKWt8XJf331HjYxVWMhfEVtpqTj3Ae49Gi5sVVo0LIMIYeyuBVL6miJs3JNWsclkBZ4slOJ6MDzxDjyt+Y1wI7WlZUpcE8EpimaxyQQ9Sv6SICkIWKd3fxaSOp JKRKKLK7 oysXwPr5T4o5xmQzwvt680IyspRxLUeVPvd8bX8pVxHRwFwDFdLE7E7Isd37btqkCJjON1n6Z8J5cnkheHoafA8j99Jx/youPkHwiGfYGMflT59P40jDFTZHxWo7COMi5UM73Ws0m8OIx/UsmSOd8k1aMI38ph2p9mWL8rTnIeJEQ3YbCromXL28f9UHXLK9ivpdF 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 two implicit call to compound_head(). Signed-off-by: ZhangPeng --- mm/page_io.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 5ddb5d9c5013..d9f5fa5b7281 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 folio *folio = bio_first_folio_all(bio); if (bio->bi_status) { /* @@ -40,13 +40,13 @@ static void __end_swap_bio_write(struct bio *bio) * * Also clear PG_reclaim to avoid folio_rotate_reclaimable() */ - set_page_dirty(page); + folio_mark_dirty(folio); pr_alert_ratelimited("Write-error on swap-device (%u:%u:%llu)\n", MAJOR(bio_dev(bio)), MINOR(bio_dev(bio)), (unsigned long long)bio->bi_iter.bi_sector); - ClearPageReclaim(page); + folio_clear_reclaim(folio); } - end_page_writeback(page); + folio_end_writeback(folio); } static void end_swap_bio_write(struct bio *bio) From patchwork Fri Jul 21 03:44: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: 13321291 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 BB7DBC0015E for ; Fri, 21 Jul 2023 03:45:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F3C1B28018A; Thu, 20 Jul 2023 23:45:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E750A280188; Thu, 20 Jul 2023 23:45:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D1642280189; Thu, 20 Jul 2023 23:45:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id BDA10280187 for ; Thu, 20 Jul 2023 23:45:17 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 8B66280126 for ; Fri, 21 Jul 2023 03:45:17 +0000 (UTC) X-FDA: 81034228674.30.DF3AC99 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf10.hostedemail.com (Postfix) with ESMTP id 4DCBFC0006 for ; Fri, 21 Jul 2023 03:45:14 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=none; spf=pass (imf10.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=1689911115; 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=CB+qHE2AIiaz5vX2bP273n+UcyM/xFYJgaKztaFkiuE=; b=EkHtH8SAyeb+nTbBDUWfsCSl9y17Z6tgsIMZnc/tlXL6JBp1kHeY1TbTotN3OATFsxodaw SgFaPbGhbeUlYm2ne47w24ve8P9MEiJ4KgqmDnn4Dw/Iszw5Fd4PrxSmn2zLvjQ0t4Q7cu JS4vrbt3SbpgNbNasq34Ieua46MOIwc= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; spf=pass (imf10.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=1689911115; a=rsa-sha256; cv=none; b=1NGwudDS9WPIyi+6wpxQmi11u/0YLmaUAWzNrqnZXnbf8oFZ2chCundw/YfxVnEDRIpLcs 4H3neCD2W3e9OaqS2yT74LyNbd2636QXNHI/0Y32eskuOd3v5nHbtR6zIFg6NJoPDNQw7y 5IBK1dLhiejpNwbU9UM/bUeClATyFuQ= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R6b2z22NLztRRT; Fri, 21 Jul 2023 11:42:03 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 21 Jul 2023 11:45:11 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v4 05/10] mm/page_io: use a folio in __end_swap_bio_read() Date: Fri, 21 Jul 2023 11:44:46 +0800 Message-ID: <20230721034451.16412-6-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230721034451.16412-1-zhangpeng362@huawei.com> References: <20230721034451.16412-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 4DCBFC0006 X-Rspam-User: X-Stat-Signature: ywoi8doubun3kuo8u6duexg6w15mzdgn X-Rspamd-Server: rspam01 X-HE-Tag: 1689911114-535157 X-HE-Meta: U2FsdGVkX1+7dXzvaMvx9kp6dsoF6AcZcO6okbhW8zrHwzjMohzNPGBVLCudjGJtmUyXLJdD0sI9G9dQUp0mSDsgdoFAR1knvLoRTDetwOmMAC7fi7QVe2jKxSLad1PhzXHM6a/vuC57cMJ6t7yourkpNdLZ+QTQ+C6ovE5tl14XrJAFjh3gRg1feSJl3oISdA3/eBLJZQPmyoT16ahxPDmhBf8WKV3PQ7+0vf4NiAYZ7i2v9wA4d4bVJ9IKILIu1XT5EF3rQ3FEkdX4DC11bbfMpK1K6pIwswek3jw6VcoBVfdLyvNlHGY4//bQ2C1aR48cr8EWoiAjQ60MNytvseMtYPhQqMNb7eC2HrMCnzEQ7H0aEcSaGPeywsu0zsqJ/psZI+XuPRmGQNKp3UnifM2vxK+QvIr7wB+7ssWLMjjb7FjAAR6bugtNoJ+Ji6I/Et6/7fjR0TrBQlkSAtCNe4Ed/E/ucrmChf/qaOiqe7pml7FmKaMOuJA38/NQGvqQ70+W0syu4U2KC2GVpDdWdZO2sy4W8kGyxjCbSThTy2zlQuE02ifF4UmiUaZoACVTvYgUeOFMKT5P/7YiCyuCC9aUrdXAZ6IXZbBBVpromgk1I3XF+zoGzY0OgkezT2UPObGl76wm0Br3wbvmWkcDOcgJYleisa/hcJQ2GPKJMX6hAIDmm2Xlp1PuOWnnEbZopB7aSVvqvNbAM2Gt/oDtVtHTLD7v9nyIZTgeHIkgSdsmNasboCXUhSfhwLs+swm0KjMly3dcer65C4h31/5Y5Iq2x1GfbYgmzpu6OzWeswEGyKiYViTUVtYCxKgpUYtI0bmSSPRZ/YX5SSYdGvwf3AwyABcKzIv6tnBt2BOudGrbiiP+QO3tZspi0qt+4lZNSWZtgl+Vy9Nw0RZ8nqqEOu7Lazkia1+MqnlHwcUOJ7kTh12rmuSvEbYVgsn6JzX+bDYw4M0coY/5uPC8mh4 DeVJNeF2 zuJ96LkQOQS7LAZ8DRMPS2Rc5Mwa2bkjglWouEhOdYIFBcI5eLo0Gyu01LMIECIzL/e1nGNXtZwuVu745b7VvD6XF0WDgYnempmtOgpFSkx6SDQXuMyPWZPRjsGXKNXyfRL7No3Ot/KN1p4xU5/e6zNF8YhxXTOQ9UFy3/WOjMU+EQMb8Iqx7ZILPMqxeMEeeZuxS 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 d9f5fa5b7281..3b97289153f9 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_page_all(bio); + 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 Fri Jul 21 03:44: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: 13321294 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 3A81CC001DE for ; Fri, 21 Jul 2023 03:45:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9A3C5280187; Thu, 20 Jul 2023 23:45:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 46419280189; Thu, 20 Jul 2023 23:45:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A4B028018C; Thu, 20 Jul 2023 23:45:18 -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 EFE1D28004C for ; Thu, 20 Jul 2023 23:45:17 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id BB72614011F for ; Fri, 21 Jul 2023 03:45:17 +0000 (UTC) X-FDA: 81034228674.23.8F3A347 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf09.hostedemail.com (Postfix) with ESMTP id 841FD140009 for ; Fri, 21 Jul 2023 03:45:15 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; spf=pass (imf09.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=1689911116; 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=UIF1/RDQxGiWQWtgFqv/0f1S/VSRVZSzWjrR6f+CKz4=; b=bsurHHTWEqPpW4ZGgPXoyl7JTcHqlPrNM8saPGIUApMddQ0bw3FaSoMLpt41FVXKmYtm6g I0GCC2NtZtN6SgQptIMB2S2NNYCYaJ9nJGSzJd4HrqSg+zNIawXldnu1oAjcb8wsnx0KDj Nkpbab8i/j5OZhWKLPOPZz/z1dozl2k= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689911116; a=rsa-sha256; cv=none; b=VvBtm+nY7pjIbtZd6T7/E/CMMeYiYTO+/dV1M0tahwQMixPA5P/Mhc+22tKd0KxQlbGRSH 4IaEvYn8perjSy96Trk7tM6MrWP0UPU/i/DhxZ4nqy748RRPht1i1v+YYAhBD5KuMXZnj0 K6X+UzE1eTf/fo9qLZtnks4uOYQaZmA= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; spf=pass (imf09.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 4R6b5j6SfrzrRqs; Fri, 21 Jul 2023 11:44:25 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 21 Jul 2023 11:45:11 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v4 06/10] mm/page_io: use a folio in sio_read_complete() Date: Fri, 21 Jul 2023 11:44:47 +0800 Message-ID: <20230721034451.16412-7-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230721034451.16412-1-zhangpeng362@huawei.com> References: <20230721034451.16412-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Stat-Signature: nobkaj7nq5errerpkotbitfard7w94pk X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 841FD140009 X-Rspam-User: X-HE-Tag: 1689911115-128712 X-HE-Meta: U2FsdGVkX190f2agX0kpOagN9AUU1qwOCCLXxVS0tCSURClBJiDwEq4PctIjzFg5lzyMk4jP69uWJL3pywUJfI05yhek4H7sQpHULRBfhswpJDgwKwxhItcZ6At2LwpUn5Sftb9Q2y1n4PGs7gS9cGl/lDErSMR9RD4Zu16AeaqR5lxS5CuC2BN4X8mI/3byc1PGF9gMAaUydD0lK0fjFBac+f/3MwP/0PRYqzvve0ZCwru/2Kobope/eIcC3AaazNB2cTy3Eu7M1yQkgzgAnY7nP/a4Gcil5tcpfHl7B2YF638cD/8rnrv4IdnP/Q5mDXhhqfjywHoIJZsmpYJqO9Vau9ZQNlb9Udys1Tj9iGqel73bC1zgWv75GpiwZmdpnOdIPJa3+nL0ht8KxsioxKNywwj7lykq7P3cqxjdkDsn8M98L7LzbbCsAFvwGwUmnB0rW5TYTI4sIqbhD7lX3uZk14PPofqQMDtAiXzSHv0QXeNRd8wJJsK46JqhvB380Brt4Dfz2xfHtfESx4tEkl6o2suJqKIy/Yox0npW8K37RJXL0XrRROvLuWZa/uyyjlYPeUJ1y/5AHZVS8FPaRReH+cpcwlvfrnx6ZAA84Db1u+WS5GOWHeVc/dH35ElMenYj/Q/STyJctc7AbcC9QbhuiHqQ51iv9QcFKHgXi/ZFIGFUvd2lz0ry4hgg+ST38+W3OjFbp+plgGmqswjxIWPlGT6xyTE+4PFiBhFyxeMMatbfrtDCWpYaUoBRbBqopmOMNjefaa96SkzOGn6Ux2jGgOMP790ccrq+2h7u9ySTEia+aGJ7uwOcj5XsA+4LkDVEerUgiy8S0x6pDk5NwYzYGQQAbEvWgu541cBfTaxT/82sIHijihtwlR9saa/KNn4TWg3mAzveycnAnR7IiC2CZGW9Q2Gyr4nIQmbJ9FtnTHMFf2jVYh6GdVDQL0FD+SHgV3Pg7o/xfdjnJX6 JcaEfunm 0La0KaUUYF10MuPsGKGlZIfzd2As/kXegqu4+J3boVNsCcz5dhl1Vfh4UUsMUePwgalz6o9HNRHYcfvIFNm/eItKgB76jumS7EO26/rDRYR6rsEX+mp4CrB7qiqRHAwnEUwxL3RisBhvNzjk9IJfOnu166TpHyQymYeC9VIetdPuLO2u0dlWXpf2JgBq8ILi+sEoK 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 3b97289153f9..7e7a9f67b9ad 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 Fri Jul 21 03:44:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13321298 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDE8DC001DE for ; Fri, 21 Jul 2023 03:45:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6FE1E28018C; Thu, 20 Jul 2023 23:45:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 54F4528018E; Thu, 20 Jul 2023 23:45:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F5DF28018D; Thu, 20 Jul 2023 23:45:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E04B928018E for ; Thu, 20 Jul 2023 23:45:18 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B7B2216012B for ; Fri, 21 Jul 2023 03:45:18 +0000 (UTC) X-FDA: 81034228716.19.9B877B3 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf09.hostedemail.com (Postfix) with ESMTP id 8CE8A140006 for ; Fri, 21 Jul 2023 03:45:16 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf09.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689911117; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yLRa2ewWzPH1vKlLihFR0E4jRNz9kx/0dw9KKzLjX+E=; b=bcF294O4p6XhEZYCOzgDR/QGA4neBMn1mc3E1eZUhvQQUQtElqPfCbgM8+02Z+nHfiOZeA KnHqGCrEqCOTAXVy7egGHJ8cXFmH+xfefeugAVHa1zJOOk3vlv9gLSiX5gq2d3nn7ceUCp eypHjp5GDDq+W1rPAcUY1jwCDOwP2OY= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf09.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689911117; a=rsa-sha256; cv=none; b=WsVe1XToJTyao6Oznzmh4y4GkE6x7gkuHy3z24sfUKnUrWmwrtYjKlvAC6+EA1DReuLTEu g+U/vFjXx4qvGoM3w0ZwkMbJdKIef1VFG5SXidg91fukUiLF6hpOWQFtJY0XRWAzwg9Ll3 urajVN6J191sLmc4lRAmLlZV1bJkm8c= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R6b5l2VVVz18M5x; Fri, 21 Jul 2023 11:44:27 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 21 Jul 2023 11:45:12 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v4 07/10] mm/page_io: use a folio in swap_writepage_bdev_sync() Date: Fri, 21 Jul 2023 11:44:48 +0800 Message-ID: <20230721034451.16412-8-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230721034451.16412-1-zhangpeng362@huawei.com> References: <20230721034451.16412-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 8CE8A140006 X-Stat-Signature: 7qyxrtct3ca6t78yz9ixuewzs8tzwad5 X-HE-Tag: 1689911116-772252 X-HE-Meta: U2FsdGVkX1815ZEOcOpG8p79Y0a5zJJLROUfRSRFN0kHrXd9whHAjTOt6ChvSgEqFuVVVnD8Ver8cn52Cj7iIM1b68htvjKsOHN42hrQvuH8JX9xMR5BUUMFyepPDvMMyPi8u0j+4WnnsYVcTa2LDJ7nuwCJDNjrKL7QXqcGCFNEq4xBYtCgzyk9yTSqOOlFYi/dXJ1FgMKfz30czZpw+DFmTgc/7D/DsrpzxMz6z82rZE6V4EqPSAWSLi+e+fdmJ8dTLBL3O/nigXPBGvCpPoFjiNtD9mV5qDxjZErgwVwd5QuPi+04u6LPAlQrsi47KmKQ4ANruLypLDmuUH5zLTrndZalTgnyqKJCF6w0+PinytwOVuCdRNjRDoZJgD2GXZr8b76TsHFVNdkVwMXImKAZHdu2YJAx44Skix6ZKlarJnYFBk2UIAGA6RUA05GlpOLEBU3V0V0/lGN4qNEpGur5BUok8fGAQY+jWMon/2sbhh8oB0/Zk4Rh0V1lvyjIvuVnYSn8vUtlNi2lMZq9X1OLnpQA7vLAGYbHHDRjS5CSZwqfP7fYUMeyfl0sPpWzE+dn9/hY4nHj1oPGldJuP3ClhB11ZB2oTfjcO4Y/P4ynvcoOC0mAODCsuTEndqkpVhUeBzJKoGkark77LtkaP4SARbD7MZfkTK9p1maYiMMADwwPVVtTDSpGt4UvYcud9awvAmzYazzyDzWLSK2h0SYUZqTvnIhmW9j4qZja0LjdxjjSODvD5orwWrlc/zIywrKAfXS/9JYuwNyNd+A9tLJjINWU2fibt8hv69XSuLsIvNrPjUFVjrfp1bvaDfLQHj4N1TnFdNwAnYrfX/Sk42GvnBjOFhNWRLRuxAwdKjuiYVkVvOnvnmIa44w9M2ZYXowPchaS0grOjDzql0EoY4b+Bo5/QLdI6p9xliJSzh/CxuL4CgmJZom/zbKRB1DxKgQRuyvUEyt12c9EtdB mnV/HeF4 2RQB1mBUo79eqe6Zsgr7SSpeKnVyNCghc7/YySTI8UlXN+PFReRfZlj9Qm5wnGiODfDvaRpXhUtbjTP+b1qQDV7EVlJHWNnZAIzpjyzWWp9mqwTxjoXvpsOECbrGY9ZgU/TucIG1a7U8Un/JDJNGvi4G/bWquemm9delhZA+TbDaglIye7GuuqJKPqYEFpLhX2Vt9UPvQuYLRw5vYaahZOdfwUFH/9XaEyabQCEopWrxKH0o7fmi1wMJDuw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: ZhangPeng Saves one implicit call to compound_head(). Signed-off-by: ZhangPeng Reviewed-by: Matthew Wilcox (Oracle) --- mm/page_io.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 7e7a9f67b9ad..9df2a85e31b1 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -331,6 +331,7 @@ static void swap_writepage_bdev_sync(struct page *page, { struct bio_vec bv; struct bio bio; + struct folio *folio = page_folio(page); bio_init(&bio, sis->bdev, &bv, 1, REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc)); @@ -340,8 +341,8 @@ static void swap_writepage_bdev_sync(struct page *page, bio_associate_blkg_from_page(&bio, page); count_swpout_vm_event(page); - set_page_writeback(page); - unlock_page(page); + folio_start_writeback(folio); + folio_unlock(folio); submit_bio_wait(&bio); __end_swap_bio_write(&bio); From patchwork Fri Jul 21 03:44:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13321299 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93FA8EB64DD for ; Fri, 21 Jul 2023 03:45:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 96EB528018E; Thu, 20 Jul 2023 23:45:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8D0F728018D; Thu, 20 Jul 2023 23:45:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74B4A28018E; Thu, 20 Jul 2023 23:45:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 670A628018D for ; Thu, 20 Jul 2023 23:45:20 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 43D83B078E for ; Fri, 21 Jul 2023 03:45:20 +0000 (UTC) X-FDA: 81034228800.15.11653EB Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf27.hostedemail.com (Postfix) with ESMTP id 0CC1940013 for ; Fri, 21 Jul 2023 03:45:17 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689911118; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VoMOxTnnrTWZ8rs4+m1BH19jtkngfSRXW7ZSyIZxahg=; b=7Frb/rlLmHWVDTAIJkX5/bvfQm5Ce/srp1lnBNNqRK0+gf0FJCmoRpMsNosq/zpd+oJjys gqIb3EG8xLAo0ANWMI0SY+L39XlXwXutCC6/4EDrwSBn1WiBNDAV6S3NaSMhj4hZcol9rC 2q7HgpGi3eWXA9b4yZutsiXoticIE2w= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689911118; a=rsa-sha256; cv=none; b=TkQeodAaQubuAaL90X5VLe1MVO6fXCWK8i2VCqzraoKp/jqFMs3DXO+TXcpI7otsflbBwP kQGS+Sui6s0Qgvzf1J/wIO5qCCpE4tbqet0JgkVTVK9Gbu/Fl3kocSLuVPu40OkqxAzOmJ UKI9uEwtfPF0kOEoLoKKwJGmnFmYtAw= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R6b5m0YNWz18MB5; Fri, 21 Jul 2023 11:44:28 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 21 Jul 2023 11:45:13 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v4 08/10] mm/page_io: use a folio in swap_writepage_bdev_async() Date: Fri, 21 Jul 2023 11:44:49 +0800 Message-ID: <20230721034451.16412-9-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230721034451.16412-1-zhangpeng362@huawei.com> References: <20230721034451.16412-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 0CC1940013 X-Stat-Signature: ikdybyuehg5f4a4g7zyx6b59tpyc4f77 X-HE-Tag: 1689911117-855658 X-HE-Meta: U2FsdGVkX19SzZDN5vcdUGQqikRSDHomx2XoZ+hsAXjZPSSQ15yyc6KeiF/cVYvrTiKukHWgIvg86vZKEXbORWf/LRx99J5/dgN03Teddedpwab5T5Jo1zJdRix1qz+YeeMRB7r+Vd2cfEOifjYZj4LjLNoibmm3YEzd7+FUHwbwGDxjKOd0AiTERml3pv6cfWLYkeqqODkBlaY4Pvs3ztpjTca2cvCQudcJwd+UCEWhFUaojv3Ixn8FCeQFQCCHj7r5OG1LDoAvIPoGTwTY49MIdUJpQZSmx3FO0vx2CMe4ELy8sPerk4q72KJ+87mOyGg8Pk/I1sFcQtB/27pK5J+raY+BreAxdJi1wpctS5l+1+dOIy80h/D1mmm7DQpTyihEbvIhe+YoFvsDHjuZyu3jJDOEUfDsC9D5a9IPQH7iip08885xHQPP/3RQJ/Q/4WcHC0JpnDVatsEm+r2lgA26Rolv0wn1Bn8CtlZ9oQr0xtl6LCyqJUBvwsgXvhBo3jKxLYDgObWPyAOE4WaF72p0npRWx7xaftaV3paESEti1au1A75vxTQABUIIkDRfOYIRkIxLV9eUFZZY9mBPul3Z3o1j2Lbl8ycvXgNeSPyZy6XwO2If4HZipNivZlUKVWMOq6wkvs/+17CDukqljUhDgOD4i3cG2csZJvtKKfSA7Z5RjFMe1dvrW4mm6yKyDswo+/M71SKh7odumr7PTWu+JqOsrTSvFWxc7HAZ+/l4FDwoa77P0Vm6xNqbEtD3QQ67vc3TrDHULQboh4ibGOK+tW2KX1MpMvrhxIC6FRWpMeaC7gfKKZlvYEs35lOHQOfMvkcqgo6C/tHiKX3EUTv4e0s6lWxFCIlc2ykgbjpTT5uR0T4QGtHBKiCFNCY4ysSecwVe059+uBOP08d1i0uf1Rj/k268TucMKHOJqkRTRw3LfUVH5mljdoeDlipYytV1GFLzx7sJ1DffkyM m+bZTMP3 czBJSZipSNhocRpXEaxy087fV1u/gD8sByVpqLqOBLGcSI48RVEPphHJ5j7x9Ap+iEHUET4H2QMllgPrTMdOo4Gxv6KHbeWVmKGu4vFhh8+CWZDYsZWWFftROdDXurgsbIGqTqPbUJw1Qv5VHfKjjxh9DPhzqMMZ5Sr2gmXZtTQPQgPWAc/hl5nPNxNv3pIqCpy8FO+PtIykka1kBMrbrtQsFThncrAzHu16YbVSSqHYo04pL0vhl5dTorQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: ZhangPeng Saves one implicit call to compound_head(). Signed-off-by: ZhangPeng Reviewed-by: Matthew Wilcox (Oracle) --- mm/page_io.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 9df2a85e31b1..07bad3a4b701 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -352,6 +352,7 @@ static void swap_writepage_bdev_async(struct page *page, struct writeback_control *wbc, struct swap_info_struct *sis) { struct bio *bio; + struct folio *folio = page_folio(page); bio = bio_alloc(sis->bdev, 1, REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc), @@ -362,8 +363,8 @@ static void swap_writepage_bdev_async(struct page *page, bio_associate_blkg_from_page(bio, page); count_swpout_vm_event(page); - set_page_writeback(page); - unlock_page(page); + folio_start_writeback(folio); + folio_unlock(folio); submit_bio(bio); } From patchwork Fri Jul 21 03:44:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13321300 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 767D1C001DE for ; Fri, 21 Jul 2023 03:45:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0BDED28018D; Thu, 20 Jul 2023 23:45:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E772B280190; Thu, 20 Jul 2023 23:45:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC93B28018D; Thu, 20 Jul 2023 23:45:20 -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 ACC8C280190 for ; Thu, 20 Jul 2023 23:45:20 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 7B75EA011F for ; Fri, 21 Jul 2023 03:45:20 +0000 (UTC) X-FDA: 81034228800.12.9C3C050 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf26.hostedemail.com (Postfix) with ESMTP id 35A7A140008 for ; Fri, 21 Jul 2023 03:45:17 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689911118; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2/8lQu2NaqApJJJ+XOK2DzlbE6EAGV4Nr6XhHRmOd70=; b=WhxZAaqKalm8Da3RH1OIrBI1KSdnl88GdEclv7g3aUIkZle8NKXdlR+9zs3VbkLHk7YZvI YxxuxzWbJ1yPZXxxU4zVhtyBTPuPXo9BTDack3ad0utxqwX1P71Wbj3MZvVq2EUnV2N/EU 0p38OcyVZk0Iv2OfmW6v3ypjpPvYxjw= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689911118; a=rsa-sha256; cv=none; b=mGiIJ3r6dgLwqX8Es/L25O2wLvhIbvgfy2TALg2BRm98zylLvJL1Fk5/7IqJyuxInFfTng 3GqLbAkDHI2EhpDrwB4WL1dw5ch1D9TbMSMpH5IOhpIBrWkk2PRF1IXpJOjE0kRxYSd+vX rPBetMRw1cMwWcaXIIaJmi2P1LJIiCk= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R6b5m5fdHz18MC6; Fri, 21 Jul 2023 11:44:28 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 21 Jul 2023 11:45:14 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v4 09/10] mm/page_io: convert count_swpout_vm_event() to take in a folio Date: Fri, 21 Jul 2023 11:44:50 +0800 Message-ID: <20230721034451.16412-10-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230721034451.16412-1-zhangpeng362@huawei.com> References: <20230721034451.16412-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 35A7A140008 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: s7b91fwn78pacumukc4io6jzc43m7x6z X-HE-Tag: 1689911117-965586 X-HE-Meta: U2FsdGVkX19pA1oATL4TOeE6Clh4bd16R/hmPqBAzIqeiBcFoVathIC6ORsaPlF28Oa5m9erK5/V0Yue8DTXVwEI34lPOnJAkM4+y0Ud6lzkyx6LiBunOcYi6JbdvhfhfX0fg1wXPTfvxlyzibBoFI0ObvPoHPUXHbgKoakaVbqXuY0rZPObYf3yGHKiXMg3QUFael/7kHTEP2vD4WMqWbeYNEiJfhxQg4XtNZgwj1DABhrD0B9mQ565ftqV7sgK3gSDstBmA7pgXV2+99FxOQ8w8VBxkKBIpiYqWwZwrNzbg42SYMJMYiv/qFkYTcRIW2qRaI8Ge6NlBTnAYhUdYEj32+lK0/ZbgXt899DvxMzS1wucgJXmaVwCcmDu06y44X1ZsYO+TayvFA9KjWp4EakgOa2MaD5x/MXaq6wxYhFKfEeizle0QWZi+N0sN6y34NdUS0at57MWURxshm3rN6nOT8FE5iWp6YnaIxKIRoNSY3VuZTglPWRAtFE2SpVBjTSUMJEBIxiSm75QFSHVrQudt6SFTzCsK1K5ZXbZPgGoZfkK15ERdfTkJe6sYlQuzKLQr0ixlOu3mWMKFYJeQ1wlVQ38WPgramjzYO5GK7mcq6Win7LgHoMGoTHpdaZa+61X5qzxVd4Guc6eqFT6dWLRK6aqMgV9NARdkrj1MGkuaI/EB0/VV21cd5mtkvg+sCbCUkpxzK7QwiDlaHLHi+EGYx4ISV82VGAbh654cLigPehq8bVTp8AtmBER1bAVbV/t+zXju4t2YHd7eNIMo9luT7n7dknuP5JHyLhXtMXaeN77e9umXy0Xm8EmiQDCFPsbEaM3vfJm9b+WqTBO3LeWa6gFElvQJ57nJtgyUwHieTj1KkCeYuxfHOOTmJzkwY+npoKK8UfLfes+Ekpz/oEej1CtKNbHI2HVl2ff2NAFPpgv/cFBsDLVxZFjl8i/EmTQPp1Q4cHJXaApYIz sI+56PUS TvLLZby/pOImh41VIPKeuCysVJ9FcQYuIaoh5ZpdTuKvQmin63yIj0aczH/9OXwgUvrEkwv4Ysunz+5ZWCUH3LItZT8GQU2G1GndcmjsQ8wL+4ouBG3jqewSrYnj45jh637F67Fi4AckzBWPknsKG+02GmrmI/ddbas0zaBYAtcrQOAa9IV4zc1hC7ePuMb8nJZGP 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 07bad3a4b701..f575c0bf545e 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 Fri Jul 21 03:44:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13321301 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 5EC90C00528 for ; Fri, 21 Jul 2023 03:45:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D4299280191; Thu, 20 Jul 2023 23:45:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C7C27280190; Thu, 20 Jul 2023 23:45:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B1E62280191; Thu, 20 Jul 2023 23:45:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id A13DD280190 for ; Thu, 20 Jul 2023 23:45:21 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 701E8A0132 for ; Fri, 21 Jul 2023 03:45:21 +0000 (UTC) X-FDA: 81034228842.13.B41CEBA Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf14.hostedemail.com (Postfix) with ESMTP id 3DAD5100009 for ; Fri, 21 Jul 2023 03:45:18 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf14.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=1689911119; 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=KNlRzNfWfPR64nJJeZxoqIl1zjDq2dYg52TSFoUVVk4=; b=0UC17pHQ79IlW9L96qEnsfKnjrCPRgm9oMTGwqtyFtAIUWBc+pHetiCqt0pEktCeGFqQXU pmTuCuncV4NTWktq3XU/4SL7trL9QRLnQionKXkANtFhPgEFIeWlKNGHyviIHeuVN62kuD 6omG8VCBtf05frHmhtCAfkL84VNLMSY= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf14.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=1689911119; a=rsa-sha256; cv=none; b=pz/hmlYu51IePEn5CFb9edA6Oy2BYFiNQxfEevuIOoQ6B+l28q2avsay29rEZcHgpJ9rAA DHOEyk0T1OPL9L1VPISRq/GP0t9uktyqg02rJLZv/9q6T4S8ffAGALg0xHa19lTgaw+m/t 891/48dqhcbc5c+UWmiSDb+jIHNmNWc= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R6b5m5KpQzrRqj; Fri, 21 Jul 2023 11:44:28 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 21 Jul 2023 11:45:14 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v4 10/10] mm/page_io: convert bio_associate_blkg_from_page() to take in a folio Date: Fri, 21 Jul 2023 11:44:51 +0800 Message-ID: <20230721034451.16412-11-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230721034451.16412-1-zhangpeng362@huawei.com> References: <20230721034451.16412-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 3DAD5100009 X-Stat-Signature: xety5zc5tr5gnj4s7738hck5q63nf18r X-HE-Tag: 1689911118-871029 X-HE-Meta: U2FsdGVkX1+OqQYeJ1Z1GSW8CTlfghdmTeIk59Nt+DL2DMoIl/8H/3GEufCxcjv6Z74OiVpZjqnibNgcBOVagDfxWcG//rc82aR+V4sCsZmEVaiytZ8eG21in3U0mxOOd13jR1oUufUsxkdZ+uM6v1X4kmzGHHeNuyLTTztVXlh9TcZeltjXN23c87+/Ovc6MnHqqaI8hU4ylwKK2zZOU2OEidq9WtpqcsYv7WSweajs3r+JA0jUHbpG54hVXYULr4Fq5J9iiv0OTfca47+oGdUa9UbzYx+VBaEXPvHRHFH4nBmY84mdJBtC0lk0/CzxDn42eGECpTrz+uMykLjzNuabJiuo5ZB5oVCvuZ/yW03qsRWPipgovsIwrKKtrg4OznQI43qtihfE3F98qdZC17QKnmHYhgXxsfK2v15JEL9Qi63RIdsIV55/cg48J3JyVp6cZPBcROW7QzM/cH80KFHD5mgigYtZEBf9dXO5PEU6AsJhhFMEbbQKQVPmSX6l+TGi8LSTQgBS7yS5pD9C284p/RQRSmCIwjp+hneCwTk+mJoAzXyl9xDp6k5PtWelT1VQGIeV9owEf1SIO3b9cZKWMvO1aUjeYlywmf6oyJPe+keaoAZtsn570nn6MmeVLlQz+AI0EMRbd5yogs6ww5TbxlDKaZ7etHY6g0KUBLi1z1e5OHRXbziLxYM2YjxuDcdzNu4vHXeYSqO+osMvZK2J/sRYlNxWz6UTpfFp0I4h7thrv5O1SR9/D/Vy+3zZH57cctQLjM2uCZypaE8tNuuPpV3oG6izayIntoWutf47Jeb9Xq58AYNPjdIeuYLFABbJ1uSp1asZDCxAiy2AeFrwPUm/2aEk2ZSmFWmWGyU+GoOhcGs2uRENUybiFCMCEyMK3drY4jmdX0RtHvEhY/uDl6XiBEXpnlZj1ocOOHA4oxLne8K18vleQCbKU38fJUfPc995UxZwcTLnkwp qeAxXg3R SDLB+3bpmXA3QrEjb7XupUro6tTIQCK4jXTrCpKi/HbL0tb5pBXU8Ltg8veXX1qMavSBkBCSYelOjX2C93n156QILIiDUtJLjawyWgxoqO+TcNuZK9Ct3cNeZ4E7xwoG14fHkf/+TGk9J7dvfM3AND2Zy/eTLIrtBVxBufg2z2oVGtD/ZdWdnMI7CUz3q8CnAKeYOQS1aaxdQg74RdlbXcxwTF3BQv/KsqKN0aVQ6toLcxq3tx0CHiPO4cg== 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 f575c0bf545e..fe4c21af23f2 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);