From patchwork Thu Jul 20 13:01:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13320491 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 8CF54EB64DD for ; Thu, 20 Jul 2023 13:02:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AB8C8280100; Thu, 20 Jul 2023 09:02:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A41B028004C; Thu, 20 Jul 2023 09:02:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E2C4280100; Thu, 20 Jul 2023 09:02:30 -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 7E6F928004C for ; Thu, 20 Jul 2023 09:02:30 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 56B681401B1 for ; Thu, 20 Jul 2023 13:02:30 +0000 (UTC) X-FDA: 81032004060.02.E496CBC Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf22.hostedemail.com (Postfix) with ESMTP id B4456C010F for ; Thu, 20 Jul 2023 13:02:19 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.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=1689858142; 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=ykgFZDiSAxnj1t96MJjVE7J5SaNCoaAHAbZuTqgxZDogam+oUJql4unTnmv3TH5xUmlKzb wYHeHg9/g765gbi9HGflhhB9HNcrRAH+jzUELukiBOBqf3Xc8nVk9ql1Q5kIoUPTr3kshw jJpu+LoUNCIkTJcBLSL3NHpwlVAerbU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689858142; a=rsa-sha256; cv=none; b=VHTKyP5h1Kyi0kvrFiOy8ocLWOMwT3V/YwjnYcQPCnc5Xh/L1fwGfIz04hOPqj7J71qLQd XOzoD8OzvEFMpv1DHlGzeiqlHX0X1c02NOx1JN08yHzzb73yI/q19xGRh7c/AiGOPai7by +qlNdCQyHQjTKwY+f+ZrhOMldWstOnE= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; spf=pass (imf22.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.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R6CVx52DBzrRqj; Thu, 20 Jul 2023 21:01:29 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 20 Jul 2023 21:02:14 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v3 01/10] mm/page_io: remove unneeded ClearPageUptodate() Date: Thu, 20 Jul 2023 21:01:38 +0800 Message-ID: <20230720130147.4071649-2-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230720130147.4071649-1-zhangpeng362@huawei.com> References: <20230720130147.4071649-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: B4456C010F X-Rspam-User: X-Stat-Signature: z6h6y9ffgwrhf4t6x887b1u4mcw1w8x8 X-Rspamd-Server: rspam03 X-HE-Tag: 1689858139-387110 X-HE-Meta: U2FsdGVkX1+0ebxzpHkxntMKyjZ+NystgKK5vErCFh4Kd6k/lCTLcA2RY/pq+uTE/YFelYebZCRZKT4xuvKpeLvuD9YUiKRtoISyLs4u8hARwNy8pX+9K74vjuUB8h7/Kn6RcLdgGEBOgEtcfi7MoyRNVeWLrc7Z0SXUFxW1XujT7JLrLAH0Lb+Gj02JiBJBa/u1G1GOGOXUV16eZcRwzSBDvRDrF7351t210AWAeE8Q6QXlUGl1TqsKviT6VTG1QlWcy4PUqghYRoQvHfwqqnmy3FRtQbuWuqL+uSbo9QXWbuclKASUjhIxwXYL0PPtvs8Yg73nSKuFAUmXGppyYF4j+b5IkIZvTCRyWv0bmr2UvZqqgQRVNYBXChB83bjXtvekZv4QckvDxVbqiqb2j7cwn3dMdaS58St12bm5+jN/zVA5Xer9Gu95kIFcLgBWsKDk8UkX6cfdXA5jRiWVc2PYXKLumHRhYEHqT7FkLHlDbyq0uyrSjIWtwCZJekuOe32t0JlJHxYLD3R8iOgKz4Rrn5WCC/tWyjxO+Uh8yUlap5sErImFkvTqTZfZ+refU+aABNJfoYfN9VtUPue4kB/qqXXawNTtUA6R5OQpFmpaZtHrDXA3Jav9O9JKlTwuMSdRAlPKyaax/f+fvNY0SWDYh4sdjQwscVLEkKLTLLRru6JWgfRfAzHYhlLxlxQ4JzAslWh/uc0VCwGoh58kTtvE6L1bKttZGG4jm5oaCtNLCFQMuiWjqcz3LhOWSCd8YmxIV9Di4cZYqA33ZXW8tDTGHZ8tM2Xc7L6pkJiK7XzXmJhN5/xQPQOwmW22CCcSYbU65kfQLXLPjZCceB+lRJOoFSYv5HoKRbKvgmzllEkEK15tdWKWeJhuxzPo9EN27SQPvWlIsX/KZ0sKtiOwY2z/14KU6uptuZsYdiswgbQtrkhPbYC7NWMiQCDsm4PlpfQnSkaMmxDTJIegho+ 9MBFlR8j Rn+bo9t4R95afDNcfiyszGXmbSoe/P5J8jndWm/otETdtiLoiAwQDubG4Nzwr1+5vTGp3nbD3mZGL4uO32yByPWFU2wMRiNETHJ68E1gKMQHR7xido8Sqh4nvJTIP6NAx5p3vjzM0+FR+/KUu0W4/VOab8Gr8Xr9IguXJvYvOKXNiwla6ZJaRCrTwoNl6triQTSOlDV0Bz7/H9bnAMxt1vhaL3FRwCh9m4UhM5Jqvc8YlxNLpOialnpSc/w== 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 Thu Jul 20 13:01:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13320500 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 EADC2EB64DC for ; Thu, 20 Jul 2023 13:04:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D19B280109; Thu, 20 Jul 2023 09:04:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7825228004C; Thu, 20 Jul 2023 09:04:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 64A00280109; Thu, 20 Jul 2023 09:04:07 -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 5148228004C for ; Thu, 20 Jul 2023 09:04:07 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 099F480252 for ; Thu, 20 Jul 2023 13:04:07 +0000 (UTC) X-FDA: 81032008134.20.FDB12C1 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf17.hostedemail.com (Postfix) with ESMTP id 53DB0401BB for ; Thu, 20 Jul 2023 13:02:21 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=none; spf=pass (imf17.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=1689858142; 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=Tvy/ELn5rBzA8TbzhT77qoOigH0n03o0P3P2WGf6OhbbUKsRxX+KfJ/HYOuttWz7P1RUPm z7/Kbwqomd5gTUT88YYNx8fTgFjXdBzZb3vh6vSGgfV4k2CN4KM1ILS43tF5edcS2WYcNu OPwB2XNMvRbd9UfsE5+1Z3OgST7ezmI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689858142; a=rsa-sha256; cv=none; b=G/oYOjCZRyAtXJjMNH5lOQT1+XPQoasbjeQuqGm+liXGO49ZcwYQ8TSy9Ng1IiNJsMigPd bh26BYTbpRVc4e09rRrsyjW4XD24Zu1lEL4w9Wz71o1ZguwyNXtgRp9/owNV7aEFDlZkx/ 21Mpe/BzgcjF8Of/hnURWWmxnYDnY2U= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; spf=pass (imf17.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.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R6CSz4RdrzLntv; Thu, 20 Jul 2023 20:59:47 +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; Thu, 20 Jul 2023 21:02:15 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v3 02/10] mm/page_io: remove unneeded SetPageError() Date: Thu, 20 Jul 2023 21:01:39 +0800 Message-ID: <20230720130147.4071649-3-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230720130147.4071649-1-zhangpeng362@huawei.com> References: <20230720130147.4071649-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-Stat-Signature: cg8guseoia8oybkekor6fsjjprrc3yu1 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 53DB0401BB X-Rspam-User: X-HE-Tag: 1689858141-324360 X-HE-Meta: U2FsdGVkX1+FE/cTOCRYvNC6z9/nND7XqHyoQJ+izkU2omDPHVVy8O4GEuc7ofM0Zs2eZyVqDbdddSu3kg5a5a6LJDxdnb1pYDts7FTRELl7qeRKFMem8a8y4SgmHr3rq4Sf6DBj7JpjT0Eu8nGVO7IHNzQfyv+paGxF2KCXXhSSeVr3YO6h3IOd7+2OAyuARA5W8ShQhOwaNaUQ0mTxibvlGWwbT7lTkEOpqKU9Jj6TgSPwKdlnYI/vIOUNAXsJ/u0KBFTfGwi9CwX/wgRQ7l8PP1S/5jXLCVn1WuniuXa8A+X6DWq2nCS+jsO68pxzMRjPp/sRb6z2EKZ26thIsogGLWQMkLSQlLOsxorjQKwGoFvfdeaAYuZjSKSuyc+KJ5prCA+bbiw2Ahqvu5ldWayejnpUvGV4wFKF+qu7q6ZJp1FWnOmwQk24XyHNsR2pgkTZwxvUGrKcOvb6yMTyjE6wDv/gcNnAF70g+5ECyGUdkBLdnXc+nkrsE2H+lxEotaCCFQ2c3Nb4gAwy45DPQM2wQXmZUPkG5fGdaGYrcIA+ByF0sZzvpjvBEBMMJilwRWgj9caPGlOwKPd9d6Sku/pZmdwSWLPTOAtumED1yAEaZwimASU6L4rXhA+227P61ZkdZOYZkeD2ly7UrLH1WrxIOAmCtG5qLDlLorLn8UDcjwDLvUNxJNifOLC7qS4hKGtMqdrIrObHFNHKawlvcCLM9P9QSSUx1W2l4X1y5rQPCiTru5tEfL5becV3edqPbbNCdexnBk8yfR9jWrMSF155dLvsQyoNgp8pFpO3WHWUrPqSfWFR+7ttGlqQJC2M0MzJNDQ6RHP1ZFudnDwpzvQO4weF7NaarhK023/mwSenWM3u8fcIZ+mPpIlTb9tFkQ0fLBHo3LayjZJMoX9KQm3H02H9AzI3VqW5KSLucBOkzVnaL/Q9S8IJ5o9/R/nALIn0BG+5qn3jTIqYq8A YvKckkBK wrv3TmUQwK5CsSv2IPG6tOa0mRMj8ewIyfjivm7lW/Xw9WqZwXw19XR4x1oygB2ojpB7Q/h2SUsWJ3uRnnfC1t8cxGl3llR6DiXUJNICrUBPMyjEQpHe+V+10MoHIUAPizwvZ3HYxtYint2+mjIChTWo0V22BjaH8ZbYAFwHbYgSHhk4OzEQgEXHkLbhXFBXpNZ7f3xV5nNKoCkaoI3t/jJepcplmxzcGJRDkAayQYqWwt5widtdpteEolA== 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 Thu Jul 20 13:01: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: 13320493 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 00B82EB64DC for ; Thu, 20 Jul 2023 13:02:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8BDEB280102; Thu, 20 Jul 2023 09:02:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 845CD28004C; Thu, 20 Jul 2023 09:02:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6E6C8280102; Thu, 20 Jul 2023 09:02:54 -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 5D3F828004C for ; Thu, 20 Jul 2023 09:02:54 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 2DB48160206 for ; Thu, 20 Jul 2023 13:02:54 +0000 (UTC) X-FDA: 81032005068.23.FDD8465 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf14.hostedemail.com (Postfix) with ESMTP id D9B71100209 for ; Thu, 20 Jul 2023 13:02:22 +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.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=1689858145; 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=Larkof9nbLscmvoTQ0tjAEFGPcQAWal5x6XwrPzVxlnwayx06tm+urt8Zd/jhRBNNE4C/M qWUin42FgvgczpaWLhwSnBaH4gLdegmwppoPSwZ89lBNTaKxq741dlJwroXpIGmlpNIoIF V98ALppJn/OqX+wwQl+0/V1mWFYrL2c= 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.189 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689858145; a=rsa-sha256; cv=none; b=0Qin38xRYZcpuSIhBQIAWp46gauywbeL+lfH81j0gYxCHblml+lpBJ9dHOCeDNZESy2JHr 512ny0kmOZXM4coDHJHXnTHb7edqOFdnRNQcBQwvsUXd8RnICNwG11n8rHe2CgiBTlzrWQ IbUrG+jcMN6I/UzPKCXAgzTh1VMgFo8= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R6CT02qTZzLntD; Thu, 20 Jul 2023 20:59:48 +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; Thu, 20 Jul 2023 21:02:16 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v3 03/10] mm/page_io: introduce bio_first_folio_all() Date: Thu, 20 Jul 2023 21:01:40 +0800 Message-ID: <20230720130147.4071649-4-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230720130147.4071649-1-zhangpeng362@huawei.com> References: <20230720130147.4071649-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: rspam09 X-Rspamd-Queue-Id: D9B71100209 X-Stat-Signature: 4dwa9o594o37yhqqd1nnrugoby13d61y X-Rspam-User: X-HE-Tag: 1689858142-923931 X-HE-Meta: U2FsdGVkX1+Y42qKkRujDu0DYkYn3x17sHU+qvZvvUzny7dhYXjDug33I0Vsuy6kwdFtMLQJfJ0WHfMIaBZE3JVNVm/0caXNr2WG7Qu5Za/MtA4oQux3ugGzwHw1j0we5ecENzh6+RkzazwSEuIR3dR1FcuZWHiBQZhRIrLydiuSDuLU27ETp9d+W6CBW5Ierkyl8sy7/XGVpuUCT3WlALVtHsERxu+zUvj0L2AughqvPwtxwkUjNqq+UPzDvXx7iHvT+Y/w60Z1IxuJ5utNu0EV8qP1/1hMGfjHlJ2pr7r12oCigxkj7PPNAH9Fsl3TCHMXySmSpbQlOcC6RTlq57USXWIdcTGaf98/cwXihF6qTazuhv5EK1y7D02Yu87LnysTKxPBghcE3kwC4LeKJGAi0BzbAfD3X6YALFkzc8asCKx9X0natmd9NUpPuILxxQZTMGZ1OzRohOtPchNA7mTRu8OehhfKaAAsICoCOAqI9LYNS8YYTLaD1vFdauTIgkGKIdYyZJrPycMA3rokGV/9+OhHF2pAAgh7TdLFZR/4QE5S7KIdLBV4xKBNbmxz2axFiu1cAH4wkwKlxsJ6kaUMkb+T67YquO9jPV88tPUBU6oiu34KvvmT9Ro0hQ3GcUXgeePzDAk3qdHEgk0gvoANMSrP770LrxmPYnmzAcCuDik5FiBsa6vp6K3Jui6UMFD2vQAjHBwuG+hQDUSb8bPpT31bbeI6iEMMa8yeWOdL6EYTaOHK056h6+GPMOdrMOoHlRgag3nm7CB82Z8qGv4L5PTD77fr/gMiI1jCUSDnpTyE7D18C2E41MOV1N4GKxw/igt0m/FngrNzBwH2BaI4/nI6nHpz7XVHb3jYHhD/UzlBmqC6gYxIS/iC9pWGxoGentM933QpUkELor5IHYIDF5GeE1Z/7ZVAzFqxsb8zO5p8b/R+3rQwCnk26Olyajz3ChpGJ3kVY2eoXvZ 5HiDGWrA gli3dEftqpyclrzFuNtpkF8JRPFwCmWhoVGAawCsOKcecoQ0HKAEeaIuaTQPw5VZgPTQR//0Mx+DRmH3+2j6EqO6s4H3EVx9g9ym0oxioVaWuXo6BTdVSe7ODTH/pxeDPZyc1WfWchhEV7BncTjro1qcsi6V7l9RJAVn+xBdZIfyXp+vhP3oouUMypbxcAHxxFqJul+MOZxEazx0g/M3z3q3QgTWOHMCMBkANZxERCGIppJW93cFgf/St9c1xL8w92D+I 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 Thu Jul 20 13:01: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: 13320496 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 E235FEB64DA for ; Thu, 20 Jul 2023 13:03:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 78FCD280105; Thu, 20 Jul 2023 09:03:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7342C28004C; Thu, 20 Jul 2023 09:03:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5FC3E280105; Thu, 20 Jul 2023 09:03:14 -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 4C85B28004C for ; Thu, 20 Jul 2023 09:03:14 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A9692B0D40 for ; Thu, 20 Jul 2023 13:03:13 +0000 (UTC) X-FDA: 81032005866.04.F83A243 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf20.hostedemail.com (Postfix) with ESMTP id 9D45F1C0215 for ; Thu, 20 Jul 2023 13:02:25 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf20.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=1689858148; 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=w39qBGoNk6fLvXKpTpapFYzE2OK3lPUMpCZTuhgjt/9BTNojEqNNp9e9y9pKa+cNNBqpvu lPRNmK8UReGfYWCj8ZBNK2uzDW7FQiBtyQfQSM4N57an+3iEVCZClb4bSm/SA37vFKf/Zm AIaJr3XWX69WOMa1wFJj0qJosk5bKmg= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf20.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=1689858148; a=rsa-sha256; cv=none; b=j75I2061gZV9MrgBjzY2CP+z11qV5u9DRdrAl9A1DEcls+u+j8W+13YvAD4IR4sSyPK8Ir fdT09YjZqGkCbsmpI6cvsbz/CDUT6jCTPOR0qlSsZUND/xWauD43q7sx7XqxtmoY8rsLA0 7Z8PLtUaOAMjtPdLZPSXjW7JwtyfKoo= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R6CW05Zwzz18Lhl; Thu, 20 Jul 2023 21:01:32 +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; Thu, 20 Jul 2023 21:02:17 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v3 04/10] mm/page_io: use a folio in __end_swap_bio_write() Date: Thu, 20 Jul 2023 21:01:41 +0800 Message-ID: <20230720130147.4071649-5-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230720130147.4071649-1-zhangpeng362@huawei.com> References: <20230720130147.4071649-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: 9D45F1C0215 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: hunbm4masd6xwg9afewnadarubtkuwn4 X-HE-Tag: 1689858145-562918 X-HE-Meta: U2FsdGVkX18MBag7tC5IAfpy+ykCt1UqSdSHcs6R7f+Zvhbx40z5PHlAzHGxJJpYpKS/Pi3MQksQpJS5u6K38DOyzA0MXB7jHUoazrAxjvdF1ocjlkrGd1wpYUhOg6Ydol5/WFAzEDdpNMghP21QVD8Mxtc+OcT0vBwbNy8ekc3Xc2qxGP4htrVibeENjHGC4MRx/klhhFPTFSQ9V25e80Zu3qX69FYtvMEQJKcg88pkJr7u7fLLVEZ1emL/JQIkgjgRwYt8WPbYSrGv7xqD/nIQCvfATJTFgUyPlEg8BmVzB5dEY6vzXC0tJ9mvzWuYZnGzD8o2pX8T+RZW0EPjb0eZNKuW5lCvYRnje2/0lKx7IptGNhi5l14qoqi4XYpShS9SkXNM9ll/W6RMYNSCP+oKJlBkZICgzwTXS1pU62pO9bETYmD+KURnBZnNBk9HSRy32faF7dUXtIiaa+EiOD0gA9nexO8xcl5zaUTvjlIvaCwYkb/IMch6Ukcl1l0sXjTboUpJSBNukQ9VZrEBI3aPnxZg2NGf6EwbYcMRhF164qWHVujeCTH0oLextcJlCIziZBmNZcfVC2ijS4eKo6jvMXGbRejYPf/SDFpTJJng5IckbItR8nQZBUnPunw15/xSGLzZ4H1SN4xIa3xXcOYLAWTZnHldNCzC8M668LJXOs1kL/OYWgvUoR5cOp/qShOYspj7FmwF7FGB8vhUMyOQDBRsaFt+wtBhQVOlLQ5ghfNCbn6bpDSdxeH9r9q0NGLpCz9Pz8Uq7GH5ukYfq9GK/YXS4BXbdRug1C+d+bJGZL+uw7MkVZnCmWGYANk3ai688ICPW2G/ekm+IbPS0lXT4oQ86E4ZfRQQCaMkdYt+D/ers/+hurYpkBh3PkheDkBOPf7qcDGO5W0nJ9/yfy/sUVPvUG7EZF4VXiriStOBvduLyA0o233hFXUk0+lR4QCEJ/KjIUpYuV6FA48 ZKy7vMLq pnJnfMcyXBsLzFuEAg2K+PGPdDqc+yXqcQZKXi1NAybDvBpa0mKMCNCRm2FDq4RWgfCDNUtb07r/vNcHiL7LXawFiuFpBVDfGLijRb8x2+wq2oC/WSPi6b68w9K+TTzDzv5ggxcLHe8nBEoyVUmf1WDT7Plh8MHdzpUJYyOKrBs+iV16ybbJJcoTvQsnMxYFzjoWE 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 Thu Jul 20 13:01: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: 13320495 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 33309EB64DA for ; Thu, 20 Jul 2023 13:03:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BF086280104; Thu, 20 Jul 2023 09:03:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BA22428004C; Thu, 20 Jul 2023 09:03:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A68E8280104; Thu, 20 Jul 2023 09:03:06 -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 9510728004C for ; Thu, 20 Jul 2023 09:03:06 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 62F38120247 for ; Thu, 20 Jul 2023 13:03:06 +0000 (UTC) X-FDA: 81032005572.28.35FD6B6 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf15.hostedemail.com (Postfix) with ESMTP id 45425A0269 for ; Thu, 20 Jul 2023 13:02:22 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689858144; 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=CgGbxf4uUHlUPHQC9eQZHdkvEwOdNubAvws+7GneAZP6NwhSEhVySv1juQaBtflCplymEk mpGaptfTcktBQjKcq5fyiWOqobByHEP6XI4DoU5Iz9Fz7WBdME3jGPeRLTfWWY1yIi7THZ h1Eyr8pNJc0zgLebgg5LpNnD5QF73HM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689858144; a=rsa-sha256; cv=none; b=NcKpiJbyANx84AN0gIiVxTlPUmQYAO/7bOE8Wr1ThxalDSfFM2PTNeOU+xG2HVCx7e6L1a SBZnYqnO07eRKr26siXf+AxwSEN8Tecv/S0V7gK4I9gVPR5VFPJX8QLRSixwcGNXjVW/96 NRA2uTHyM+jDKOJR0834AE3/wKxTIqk= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R6CSG5GfNztRdc; Thu, 20 Jul 2023 20:59:10 +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; Thu, 20 Jul 2023 21:02:17 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v3 05/10] mm/page_io: use a folio in __end_swap_bio_read() Date: Thu, 20 Jul 2023 21:01:42 +0800 Message-ID: <20230720130147.4071649-6-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230720130147.4071649-1-zhangpeng362@huawei.com> References: <20230720130147.4071649-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: 45425A0269 X-Rspam-User: X-Stat-Signature: sgkpxcudhtmj1467zsey1pwitanodajy X-Rspamd-Server: rspam03 X-HE-Tag: 1689858142-26185 X-HE-Meta: U2FsdGVkX18pYu2+C3JJNkheAk2sgLR+CKoyh+KvvhpU6WI+ljQEtDo361XaIz/wTjZ1P9empV6Mp8pbFHQ3DFIpCP2zj54hYyWBB4UmiTXE313yThIxhyiQr+R85ZgnbF7NCz7CSSDclt4Qp8QTFt+Sqh1oV7cYNIgE8T0JZ0NIo4pSWYDIgFxPbnD2giBU4QCGN09h2CAotJbSO47e9tUHd+0seCdImSROM26ZmzJI/TOiTxsU1wxnQ9N6COt7UDTRTob+BBRgljNqNHB0Ly/E3Bj32wW3N+ZDIqrp5vQ0szNYIyS/89QMWCh38U6qDg/qX66XlIZiF8ox0720D+ayASQZxDw0/QEl+A3DnyF7qWeV2N1qJWLx052s2R9FbpeGpE2kL2LOjqqXuxddT/aDLpLUjCiorMewBl+d+FEGoHBVvilgJsz9TqMmMubVK5xqDthMD9pEN3CjhrAZZmqqMgUW0Fxkep8bt1bFY3a0k1zPRj51Z2TL9bM1Q6jTgCQQuuojv9VXTBMIxsP9NwdIfGDKLv6I+oaP/FP2acu908XxOV+iVcYOb1ABYMQwsObUDs8/1jaWzakeMZRVKU3moOwIaTaFU/sE1f/hEKOHDEsHpuQaiIn67lzoi/ooMULt0nV3k7wKF8Or0tw0JXIyYz6YgcDlk3n4J/z8k/t/U74z1DY843pK/IZY2+9mpRB5Zk5cKF9X3yMcw/oBPwnFGPOQdXf7YuVtzo5hF6CkQI/WU0BJ/QDieFsIzgBWqVpZzPJ34hqrnJ9dAISBJ6lggXpNueCZm1G9ArdEwYTWYExj+RZQ0OkNAs0ZwFYfz4pKtKRKuEtiocZBUvGMR9J7AcHFDyDF5b04Q3vaOmrVm9ve0CjhFUBwpVHtFCGSb9YQyxiflwSsWTL5XR6MxNrWPc72Q2bkVCRoG/vKlRyg+MjJB2t8o1xi/3vrg8wGR8bRrF9grWm32nnF6Me f+6K8GDJ N+Byngkk0B2l1gcVssKUQ819jU/DCoLy6FzAyGJ+3pPmFzYX1l6tAkWIC/P9oixPWb1C2tsF9kEKFjZGQ1MEM6qodbDYUNi1nXge13HML8hb3q+NyWfUDYhNwFs4c78yKRgTKJRTqEhqk9LxkMAaVsXsnmuB7BE91auXThY61m2mB43UiI3vlq/F/i3Vz1l2qmXSP 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 Thu Jul 20 13:01: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: 13320498 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 ED185EB64DA for ; Thu, 20 Jul 2023 13:03:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 84797280107; Thu, 20 Jul 2023 09:03:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7F78028004C; Thu, 20 Jul 2023 09:03:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6BF4B280107; Thu, 20 Jul 2023 09:03:57 -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 5A92728004C for ; Thu, 20 Jul 2023 09:03:57 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3374E40245 for ; Thu, 20 Jul 2023 13:03:57 +0000 (UTC) X-FDA: 81032007714.19.CFDCDB6 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf03.hostedemail.com (Postfix) with ESMTP id EA19920179 for ; Thu, 20 Jul 2023 13:02:23 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.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=1689858144; 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=kiGg4374bz2rOVXsDX1nUkcMJsdHFfpEzPUPzOWOTGzJO14twL4mvZuqi6Kq2nxZzkGknw wy3pUB+mjzPNcXngt6dD2W2ZFq2stLdY7kFJp4jItdr2qLMe5ql0/d+vYjjlKnHU2j7/r8 3o0yTUIKFSMahFC/FwSTjJ4kEUGUdiw= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.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=1689858145; a=rsa-sha256; cv=none; b=t/+K6O/R3fCnHOGVxPKFFjjeFN1lIEk94Rg4MfDyxiqOOq1GzjIHmrxsfRXmP+oEU9JRT3 cYT2dYtNWYVN+bXu7RhgK8UeLLzLUUZAbBxZss0BGZb3upq+pmxiRpD9VDku+xedq8KzvE 1kfdGZ0N3Kn+CDqHZz2EfklOLLxSGFg= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R6CS30yXYzNmVt; Thu, 20 Jul 2023 20:58:59 +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; Thu, 20 Jul 2023 21:02:18 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v3 06/10] mm/page_io: use a folio in sio_read_complete() Date: Thu, 20 Jul 2023 21:01:43 +0800 Message-ID: <20230720130147.4071649-7-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230720130147.4071649-1-zhangpeng362@huawei.com> References: <20230720130147.4071649-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: rspam09 X-Rspamd-Queue-Id: EA19920179 X-Stat-Signature: hcpyk3roozb34p3awbm6kywed4asn87g X-Rspam-User: X-HE-Tag: 1689858143-487641 X-HE-Meta: U2FsdGVkX19gilUbu7ULKCLCDGWMZ1WUJn8RQPQN9rQNgVqTcJEPhd5FKU3+op7UMYRjymdUZc5S/Owf9TluGCtyiJbKmuG6k8JwROvwvwr/nByIBZsvVT5QpIfJfb0vaU3r25S0FCoNBp+Sbt8RUUdSKtNdjGsfbLNaWYTFHiRyygaTbdgu5sC33OGpJGbvL0mr+Wz74vqpXSaRaswHcGgQthQcvHpd5oiGMKhqqdsUCKRDSSCUTYr2erdncnU6Xl5xMqfFlAcDGZIOGLXq6E3KzGriU+yoJDsuc8COA6/U5KqqMiGELZBXZeBSju+YhQo+466770D1WxzNtjODWb3luVj7XTuitXVjl11GWUaORsZz3XLMAjNZ4DxQqoOxTfj1y8PAPtynva9Rh7Knj4aH2xPl5lT5coj6al8K0nCSSpCvQq7aX/Ai7r5YtG3EhswFUFVtndxeUbe2fHhQl6HFFeHpZKHNSisUP58H+E8FjwGVHZ9rp30VcFa+2PC8ajRDfHBmIr53+v6smz4jkZ9W4kp0YRFnPWTdwHD+u006njvbJa69xTlEm1NKl7wIZ5MBkK3hEH+QBG21fPUZoyQf8MUEen+JM1Dg+cxCPmQq1xhPQFoBQHkLlYuH5vo78IkV142F0n3OYCrjgaWFmCKcjo0vIOeJLh27gWnKVDN76gfDCwJPkOSO0jy9kAgI3CGJqyagDsqHBOIWgcPrTMmyRbCMKH05S9F2ch+t/8SoIGQyMlNsH739jt7BKcyJe6PVrdgKrtOeOn9ZqK1vbSPjxRBTBbaayUMCpoD1KzdeqPadbiUboKcWgEZYN4K5+xwpmOVrA/K9g9oI4OuKg9kP6BplhQWjPLKXyuu7aii7+XcSjN/r+pZbY2hv56aClvs+6+PNw+rak9Vq8s8SJVjuQe993a2rSmGBYmTKE2mcJxN2u9iyyizxyWQ3SNKmQcetucPhjjdNVkchmhG C6L4gd2V NZxfUt0ybIKiS3+BzuMAJBZPD8rbn3Iqv4k+cjiv1CAImjqNDM4jwVsfkpDkjuwxLmtZuHFA57WNkW1GJ+bu7ZisQLnRPol6IAJry3+CQFw8/TeF7ptwusvWP1vlFV/3trgDmslMfQSCB3pibU0Uc3Vpq2va1Z1kuR5P6T4HMEmne2V1VsG0Alusbp7XhnZ169FDi 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 Thu Jul 20 13:01: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: 13320490 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 AA456EB64DA for ; Thu, 20 Jul 2023 13:02:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 428E72800FF; Thu, 20 Jul 2023 09:02:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D90728004C; Thu, 20 Jul 2023 09:02:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A0482800FF; Thu, 20 Jul 2023 09:02:28 -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 1749F28004C for ; Thu, 20 Jul 2023 09:02:28 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id BA3F2B0D92 for ; Thu, 20 Jul 2023 13:02:27 +0000 (UTC) X-FDA: 81032003934.05.F9E296E Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf22.hostedemail.com (Postfix) with ESMTP id A0834C00AD for ; Thu, 20 Jul 2023 13:02:23 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.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=1689858145; 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=tsO4OAVPuI3SUzdRLykvHoTAdnEV8ZthUbtfCWvvProCNrzFm202k3L9EeqM+8pFy1AU2r msBTy2MFJ5r8DIWZZmbDn/8tVHey9iuAS6GjxI/3ihyo1yHgpe1g41DbXpm3SglYEZeMUy Vfx6RHB/VNT/fMIDBXhNoSPKGp9y2JM= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.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=1689858145; a=rsa-sha256; cv=none; b=ORp+K7mvxXG0V16G3XEb10sBycedRX9WmK3LlbYlIaxY5UZtbRG81+d3dD+NAJU1k8tlI/ NrE57aGK7RJ4qGBoZ2/2AlueHhMBK251ZcNYDTbH4YgiC6cHulKxWVhQaEBAI0fk8t3s10 COzNPy/zRdEpMYDPdJeQmzY0AYyiTjI= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R6CVH0XC6zVjqr; Thu, 20 Jul 2023 21:00:55 +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; Thu, 20 Jul 2023 21:02:19 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v3 07/10] mm/page_io: use a folio in swap_writepage_bdev_sync() Date: Thu, 20 Jul 2023 21:01:44 +0800 Message-ID: <20230720130147.4071649-8-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230720130147.4071649-1-zhangpeng362@huawei.com> References: <20230720130147.4071649-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: A0834C00AD X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: ntkwu3utioh1m3huxius1hrhsqcitcy5 X-HE-Tag: 1689858143-175909 X-HE-Meta: U2FsdGVkX1/15m26aHqTgLQKsKaTC3w3a6au0Pm5gtFigT4hULqAcH7dpiEXvge4kkv8ZzZk8Zfi83VOFadtbuzSuhEUXvr99QeyeFDMTXg8izNe2h76B41/u7e5JC32ltr4zxAo2YSHQEhEYmcH6Du05Pr+KuRR73ak2NnO9qiljSaBwAhfKMlmekOy20RdpxAHrU7oe9SR3OBBSFAMgYwJgOmdD9wj41Mgxio2QHZtNDLUcSVQrJqo3j7wD/xm5YmMOH+jDF4i6DrslhKqiOAhZlP7ZQcghLHW3egpYnqtI6PqntiEhab0Sh8vnfZr/aYfuGUiREUjQYF7jJRPEyd4Jq5XZlPNiaVyMNb6ZAmNsR9yvm3pMSvLCHqGKyLqBAe9ULyTFHsQt6LE1iGZb7KeaFKCFkrlNCoW9Rryrti21PwPHVV8WrU691WaSM8JW9ztrsWYpsY/5PC7aLOOvVlnqIe5bsabkzVosWS6vHbkcw9m+sBPjpoPXyaY0C4B4hexn5abZfw1hP1tOWcHFaUn31b2UTMJvcjZVmXKQ4szkx8kKRf0a+677m+KHP/CBB8I1j6Km/6T3y9i9n4XKJiyi68+d7SNf9sKSxEgykx3FnQhtUOZSyOjlgk78boD/msELKF8pk3kumYQ33prLxo+Q/z09yz9Z38Lu3dPH5f/tS8zKJrN6dbX/a7qeU1hQZvnBFqVYXCupiNTEA7zf9D+AmuqWJPUvCbR7k+IZBWSe2BuJMDcXbXRJWXAVcrzokSlQI7oCnU1YSy9YJM8HneWZMV+FmUKJfTr7L5GtlueEuzcnO4rzTL8qNA1WxzgFVG+dHq3oCJMQ68ZW1ZB7G7kXzHeVrhzCCsuxk7wA1Q7Dkr98385K51i9VHeGCwZMtcjNXVwxyMGRKzQWAjiETp5VuCyB2cccQBEr49GN3RjmLYv+uAI/Msz4zrWQ81w2z/nAHPjixANU0gnbEU BH1vuNOQ Zd7Pc3wquOrZK6Ke3JfR0/6CMlRotFht32nOLCZPD4ejemr3lYlqgEaTbDGC14VEIerB5IIhAFUAaNfZ93SVhc5CJefBxD7LWf+2xlhhqnUe3w+bfXp81FyYQECbeGZ1kYE1E4V7HJ3APQJSLliLee7O7ULp79Lzyy7TDXeVeHgDGqMaPFDHPQ85ZtHy9+vZa4v3pOuL02vlCVFqZU0QtZsl8pu5y5xQTL14Hb8JVL+2SjI3nr/L9c3pdrA== 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 Thu Jul 20 13:01: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: 13320494 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 958BFEB64DC for ; Thu, 20 Jul 2023 13:02:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2CAD8280103; Thu, 20 Jul 2023 09:02:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 27A4828004C; Thu, 20 Jul 2023 09:02:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1414A280103; Thu, 20 Jul 2023 09:02:59 -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 017EC28004C for ; Thu, 20 Jul 2023 09:02:58 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C6583B0DFC for ; Thu, 20 Jul 2023 13:02:58 +0000 (UTC) X-FDA: 81032005236.05.2A1B3B7 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf27.hostedemail.com (Postfix) with ESMTP id 2D18140105 for ; Thu, 20 Jul 2023 13:02:27 +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.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=1689858150; 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=TrDiELpysyGmwPgfc5JQKW02FXB5xsL3F7MOYSYZ1jHjf1HGn/N0s+EMgnYnT7rJAaovDe GntkL8gZdMvpkds8qycxiVlVrDtjbqPr3xcUi1haUnmvobYUXK7cfaXeghD0XDY00RxGY8 SSjNa2poURrcTA77Yd+XQr0yFAJgFjY= 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.188 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689858150; a=rsa-sha256; cv=none; b=RtxzARl9q+i5V7ps6LLDXFcKrjj0EkHeNQsQBvEqy5/nUEP7B01x6J9fTQUACSjCPplk/c ll9LI+oR60jo2oYHNQ++n1cxCFJhegVaaUkgyvJHR2l00rpMWvziqq+Lve4KsmbyLCzcuf jsR67bYlanzjo9WjNCUibaBv4XprXIY= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R6CS44zXXzNmTw; Thu, 20 Jul 2023 20:59:00 +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; Thu, 20 Jul 2023 21:02:20 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v3 08/10] mm/page_io: use a folio in swap_writepage_bdev_async() Date: Thu, 20 Jul 2023 21:01:45 +0800 Message-ID: <20230720130147.4071649-9-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230720130147.4071649-1-zhangpeng362@huawei.com> References: <20230720130147.4071649-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: 9dbi1uup7pyn1xqarmnpfqqs1qapezko X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2D18140105 X-HE-Tag: 1689858147-715540 X-HE-Meta: U2FsdGVkX1/9p3g01yDPPgcB2ARqJhcE1T2qb/i6Y8kjJRn/IYOFw3uPUNxsqQ8w7g0V3ZSo5ubmb/ahHza2RUzBbRErHa/Km682i9z+WcUC9UuQNgncIk6i7cXVaIPjWYzXdL6akfi9USCIrvcFkO/IwAZ6DK5Atm1jiv9BevrcNh613wWU35iyPGeh2acolTBhPZt32wS7eq+sNCkpWGVJA5vcn7dajs4GUkhZmR4MxG1W9gcDtGyzhVZVXFEdlgnoK/yDOFMJ+Z+SAh62TlIbIuhw0gNiyK3VXLFZAC0/l6NgvDtKpi0mKPX+qGZYzpFzoGoUYoN0d7fSXkI0AgjC/sulIyRnzxfegwkXt9qlIgS8nl/gJxKthqIlqOC8EnH5ew129dj0t4RjD7jI+kabSstdcQR/88sR98stK/6AQTKx31ePfmkhVbJP8vjpOQ4lnTH0NyCCDWZbZBM40vayYHceuAwQU5KjTA3tsrwbABKBSHfR/+gTPZn8PNj0VW73t5xjUdeuiDeVnaHUMQsma5Z+007j4BenY+yC6zMvOfDaMAsKD9UDtgEvhDa8pscQreM/TopAAwtt/rMoEHz+xycn5tx11R52Hj5j3JvUbvFj41FjAcoJLRimVGuvAX+8+eXJhtCrLwZhYX1ycwEyw0crvmnXtlrZl1WEb4tLL2LHEjyHoXVzVX0HIh2BQDM4Xjdn8unTt/bZnCYSg0H+KZvRsV9bKpYq0GK3eay6viANwkDRpOTlEXRmU2wdiSlurHqrTwtSwrIBc5YyIF4P+/CrBSMlZYfpMwjcgsEAV8A+IgGwFKBg7uR2EVM4em/mPOiw1KwOKuF9ka6sTsdxkkOWuMNEZISidxqQ3PcEodVAy1iuKXgfrB2/iMweEFhuZpF4gvybbxyBi4USUYAfCX5xwMj6seB52adurH4HjJ3mq3VYcmZA8RBC+b/YZzsbmTfNTu3f5TtM3h0 oro4JCtE ir2QNNzjGz5qDWYKg0uykXHTmLZZXi1YNia/L8XkDxkAxO1mYFYzdJk1SoNSl3HIXTtATJ4ZWKprAalmbbzUV21ROnhfkRCsMQKpM4cJFs65joYGygpRIMmrTzeTD6Eng7kwz9CTswAAB/S94D6rYHBNblQJidj/H0j2aOB3o3xO07SWUo2W2nLAXG/urxb/oqoShCH4QIV/w18o87G8Es88FuCFaRGtUfIlM8lmoKSHPjTYzWvhVh/MX1g== 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 Thu Jul 20 13:01: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: 13320497 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 8F036EB64DD for ; Thu, 20 Jul 2023 13:03:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E61FC280106; Thu, 20 Jul 2023 09:03:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E125C28004C; Thu, 20 Jul 2023 09:03:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CDAC5280106; Thu, 20 Jul 2023 09:03:14 -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 B871F28004C for ; Thu, 20 Jul 2023 09:03:14 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 4E09B401F4 for ; Thu, 20 Jul 2023 13:03:14 +0000 (UTC) X-FDA: 81032005908.23.75C0321 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf21.hostedemail.com (Postfix) with ESMTP id 7B88F1C00D4 for ; Thu, 20 Jul 2023 13:02:26 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf21.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=1689858148; 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=ZiToJVy6IXCLdfNrEMRmMkKZFmbdR+n71Ox99bPoVHs=; b=uXzcopFQtdhGxX6VqfOjnv8i0+hX4qR1VJYganEvlX9Ekr9UnLEKgsuXVGKKq93Fm4NbNP TSLX4HweupjqvjkZGIJJQW1yN5iqoWyh0rh36Ro2TFVCV92V1+klExNtBpT3SgRlzsCBN6 8W+9frhD0aLJ2h1OHjUEn6eJvGFwlow= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf21.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=1689858148; a=rsa-sha256; cv=none; b=LYxtPGV5KmlXUxdwrcolfO3/vfkux8EnX/NAma/4rhGo+hU+RpaL8ELGcwYIrNgYM01nBd oXV5pw3osGAX3yd/NSi59hrIuF4VplSIsF1uldv71WgTLRONxHgay75f1zvlcZzUBR2uQF yyk7rTz2j0Te/R9i3gDy+nYBMH5VUY8= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R6CS53LFGzNmWS; Thu, 20 Jul 2023 20:59: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; Thu, 20 Jul 2023 21:02:21 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v3 09/10] mm/page_io: convert count_swpout_vm_event() to take in a folio Date: Thu, 20 Jul 2023 21:01:46 +0800 Message-ID: <20230720130147.4071649-10-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230720130147.4071649-1-zhangpeng362@huawei.com> References: <20230720130147.4071649-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: 7B88F1C00D4 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: sma6icnhd3haqjw66wfyyp3b33f1axdd X-HE-Tag: 1689858146-928662 X-HE-Meta: U2FsdGVkX196ZH0teYmSCB35STjlFzi39e0zJ6KfwF7XCK/4+4K0YbYtwZ6fLHg0FP89S/Q1W3QXVhKOdatGyDKmXNb3WMue59CcbpBXyP3VSOvJmxVE8E8Qo3sa8w1U6RM0abbDQqdZhD3ir9Iovz92Nhda1Ydg61GDj5QmD9flKzSo2BC2vrVSIRhEXqoSWYjUdUC38hoQnbhjY0sQouOQoiY9jzyy/w0KcHlh2J+FMnh3GCz0c+jszbGV3aJrzGNQegOGTWYSU0BUwizFgcKSty4ntIKZNNBVHgltEt+quPOR7eq5CinDkP+mAo1WK/DO7KCn1i+K9bddi/0jzDVHHz2ymwv3VIuhLMiPdua4qctPmzxZBCOQw80t0YfdUgiMl2KL0xG0Aiga3jf/rH5azXQi5+4GeBzFdhm9wBRSnsCm+Aw1nuzxp0pOiAIZ8DBQN/qeeZ02w8f2Fhjrjn8f4Dk9oavKjUvoGlQzkqJIqKe/vOTreGLNqR+XqSR3KwrRRWHKM+sT2IdH3w6rtP8lhuy/TvGIMBzXSiJcrP5oF1AdBjaXBslIxPzhmtapjZL/Y2RAtD4k0AvL4OjOqhLnGfLBFwvEGQFkDoJ0NTcp3sZCnsVfIsj+yEXtf5xoFHV8l1a/uRRqjrMKIJa1uoMgSBahzGbDyiBcp9XbWyf6v0Ii6qagFU/6npiZiOJsJC5zJrXAjgo0zb//U1dFWLodrk97KUgTVo7aJFG8omsR4Z0+jtDGVVx1qdoJB/L0PmyU1dHUJorTagdBoYk9bxhiw4bNvw7sNl7gluVm2V0vvaUsKnLIfHrLrUB7K8GiCqMferNQZxwVuJFeAfmAWEOq+dILYnmfM3PN/D1j4W5k4DWQ90AQH1cUuOj7D52q0RXw3dprTj6+9G/ertHZAQY76GlxOSkCIUQKTtyiZdFD/Xyl40t0J58HuF7MVAkIPyEjoLaBDs9jkZAF2N7 HXIh3AtV Rbx7U1jgqG1kJ3sfndJjVoxsA/vkE3zd8KqZfG1BtnV0krEQHCLuBvwNXxizh+NMGfmgvp5P5BpLbWZl4ZL2ut8AyvHd65puR5QrAkNlkuRSmSigjUPnM9scyL6XwrUpxug7A8Eh9CLsAq2bXPqwP9kPVt2AKWgHhh3Ul5AHZvU6AlxK6a3VrF0PupvYvvFhMf6Bv 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 | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 07bad3a4b701..da3f38404585 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -205,13 +205,11 @@ 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 +278,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 +337,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 +360,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 Thu Jul 20 13:01: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: 13320499 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 D297CEB64DA for ; Thu, 20 Jul 2023 13:04:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 67331280108; Thu, 20 Jul 2023 09:04:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6223628004C; Thu, 20 Jul 2023 09:04:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4EB39280108; Thu, 20 Jul 2023 09:04:02 -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 3E97728004C for ; Thu, 20 Jul 2023 09:04:02 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1CBCD140218 for ; Thu, 20 Jul 2023 13:04:02 +0000 (UTC) X-FDA: 81032007924.04.A99D69C Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf03.hostedemail.com (Postfix) with ESMTP id 8D619201FA for ; Thu, 20 Jul 2023 13:02:26 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; spf=pass (imf03.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=1689858148; a=rsa-sha256; cv=none; b=uYD4PZ8Agzk+g1BNjGdJp/LS/Sc9cKVFtwZvzP7VJhxvFh8nufVW1HVA5l62GfVIPQIitY pug+IZRIfYc4ZOqPuYqHhccI1d7SFR/iaR+Kw8SgL5qzujG1hz9FEBk7Jtuaf+0LVnZdyS THS4GAPHYSvqGHCIhnXt3E5nJwHCido= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; spf=pass (imf03.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=1689858148; 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=4t8XLJPyanjJPYKfxZvv1GZ4bOrqT8Oez47EILxWmoc=; b=7/uIsPMIT1w+/Gk0svHaV7/kUGDSUqFDB5YgFXtyk4gDeeEvzbrSqJGZblD3f1S2qilq7e 0DLGwRAL9ApCLhDHWp+gC6ngTbD6wlzfYwTKv/Vd4zZoUqSIqEA9c2K8EKg2WgUjJ6EtY+ /xwrqcqGzpsQ98VQoCxzPYvkO6D8kXQ= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R6CW44vcBzrRqs; Thu, 20 Jul 2023 21:01:36 +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; Thu, 20 Jul 2023 21:02:21 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v3 10/10] mm/page_io: convert bio_associate_blkg_from_page() to take in a folio Date: Thu, 20 Jul 2023 21:01:47 +0800 Message-ID: <20230720130147.4071649-11-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230720130147.4071649-1-zhangpeng362@huawei.com> References: <20230720130147.4071649-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: rspam06 X-Rspamd-Queue-Id: 8D619201FA X-Stat-Signature: hnxfutm9fuifayb7j7cyagubxjsi3h63 X-HE-Tag: 1689858146-341598 X-HE-Meta: U2FsdGVkX18plKxmovGvlACRMrm3GJ8iOc2mw5Cui39Hmzm/+rojvTZ6wNlNZ6HvJILfz5hbSi89W1xxRoo+5O9+ofXQwFvj2rR/99TYVjMO3MWZu+jvCizPlHairH4NX+C64KTLZYqmZhh8g9yu3xHJILPnJA4m7wvFmU5KMi9gKl+sBexyMUyBKQ7HKGnMwTf8Z8M/6vHK9B66HUzk8fiL+6ovppqXbDRqDQlfpibjQ24GnRzm0g5Foby+1Lc4GneOXneOy16ti5fR1c9mTZAm/77OD0S+nw35+2/XC50XtaYYD+G6r22Q79d1i+Z8IDNRhK2K/fjDrCCm04WFdb6Xy6/k8yjQ+VR/xyCjpNjPcjVnPtVjoN2hOLb52s3eudi+rjNKM9P1iAb0JQpzutdTJecbmMipIOz5hJ+kRjK1YoKiQktBwauM2tTLkx1J1GWp+pQI7sCpbS8iHYuXnMlHQP1tpwcf9CWhirdTlNe+zU+7yoDxw1a+tGgBTKKDxogVsNtPuxWIVB7NtSefKvvXO24kWGZv9LPi44flnA45yG8Z3lM1Tdg94s0Fbt1xc/pmZDK5GT3xg4w+okSWD22nIwx/rpeGZIk8BUiQqWKFaX0IzE9JUuh9cdeMHanOD5k0J4fDQedOKQOiFNhoiUSh1lmDPIk8weU5+/9GHkmBDSRhWpZc5Rkk/0GTJrVdXAJJTqDSTFAjM10iTDsRCCC9crBY7fRpOgpugXWepgeFYaRoUPhGdlfs9TNLhZFvT830N8vzsXq/f4a7OHW2RiMJaBQjMUyKkylyAP1eNodccj/syXuvYE7Q6jn0m+55Fz7tFCRpvheG7Ovp05KfaoURGmvKq1xlXec3yg0Ce1R1fJ++2SyqBm5gB8VJapj463Xq1kYMe59/tl1d7GnY4LzlxNvpGIkxGwW6ZoBzqlK7a3EW69mdkecaae8I2+BZ4KwltiKyH8KiJTjqF1V 9SWLaFJb w08rLu2cY+a2TcsXrm9puG1rT9y2ugrPDN7JNkTZb/gos/rqNANUjkLfqCzUZzJua90xwm7dPRs0sZOTkTZKyZETggPKCRWVoUwqaYM3DuoVSlEuW/0UUX3WE1jr9w7CGZItj5j8coFpnRk0Lc1CVVmNM0MXZbEn2flA48XCjNGbxuc9iqlgjH+LqCIHJlMyzpdsKVktY0YDJIXkmbf8CgcQH66/Or0Nef+DKweume5evaJucWSqD6z0EMQ== 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 da3f38404585..cc2503bd511a 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -213,12 +213,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; @@ -228,7 +228,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 { @@ -336,7 +336,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); @@ -359,7 +359,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);