From patchwork Thu Mar 2 11:58:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13157121 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 8A605C6FA8E for ; Thu, 2 Mar 2023 11:37:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5731D6B007E; Thu, 2 Mar 2023 06:37:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4FBAD6B0075; Thu, 2 Mar 2023 06:37:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2099A6B007B; Thu, 2 Mar 2023 06:37:50 -0500 (EST) 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 0796C6B0073 for ; Thu, 2 Mar 2023 06:37:50 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B2F3640FB7 for ; Thu, 2 Mar 2023 11:37:49 +0000 (UTC) X-FDA: 80523758658.10.06A4610 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf21.hostedemail.com (Postfix) with ESMTP id E36661C0002 for ; Thu, 2 Mar 2023 11:37:46 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf21.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677757068; 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=xbLPhSiqjy6IWZ/qhYrXAG1DUxlcCUFQt7fRdvz4lyg=; b=60PGgU8+tB+CJJdt+vLQ9dnDfU/kZGkit39NblVToIm6QLP3kPTLf+5agJNeTn9nuODRAg kEYwbPJapyKGshos1eF6n7jDPBsC520SgcB8zRNtY6CoVjjUFZOF8s/ysfUQtEcQudWOgx WKl5/1zmreBr+69yoHFi5fk8Avojd7M= 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 wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677757068; a=rsa-sha256; cv=none; b=ubtzjClycDrPyWPIhvwVOU8RPiSMJH9GPRmZr6tAv555vIhm7Lp2y8pQMYAO3K9FUKeWrd JFBzrIrozHH5swGoLFhnii/yIslUsKv5SMTbTjozqmJgZiC9tNh7ymgxPEQHfzAf7SQn2R NTxrpC7RyuXTsKkedBOHzG+u9e6BkEo= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4PS8Cp0vWWz16P6X; Thu, 2 Mar 2023 19:35:02 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 2 Mar 2023 19:37:41 +0800 From: Kefeng Wang To: CC: , , "Matthew Wilcox (Oracle)" , Kefeng Wang Subject: [PATCH v2 1/7] mm: huge_memory: convert __do_huge_pmd_anonymous_page() to use a folio Date: Thu, 2 Mar 2023 19:58:29 +0800 Message-ID: <20230302115835.105364-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230302115835.105364-1-wangkefeng.wang@huawei.com> References: <20230302115835.105364-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: E36661C0002 X-Stat-Signature: 453oatr3xn8fb8t7posjgtg4yiyeyykh X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1677757066-356002 X-HE-Meta: U2FsdGVkX1+mkWEDb27hwf3EX1QwwdXX1uzjbNzpnE4/zIKtkMRD+iAd3+d/m/1AoO0FYPm/bcfILDSvjGq2GHHyRozg1osHMknwGmjd4ruEofmfX9tP6ltmMGYTBL4hqVLxRtP4dStBTIt//JEHCE1JxW46dvRlWuQrgZdgzYTMEc0MCsLkLptoXqndxJJBh0536i9UcwBUe76BbEyaTMRh339aaxSfdXmiYFha8OAwlv0XDWPVWpnRpBR4XFKeDESo68hRxfwul9xoaL+f63sRoQdDalhL36tXwDZriYb78eoK2ag+pLY+kop37TTy666GRbFQwkih2BhswRumsRZRhBL/dVQuHdXeeIbBR7v/f60vx9zLWAUbdV0LFQEXJI7552BUVqc/huSUIsH36Dxa+Ou6+3RoAxeeEKSQzBoDUnUCZrTY6PF17QJUjfHHA2Uen+mXBOAa3ONDBFE6Zfqu9rkEQ20K/JMwlXwGkW8opv2cs8Z3q1q5IydJwfbCFHr+MvJ4VMLsTvv9+8NjMsvV4lnxDi5OA4xxYjqD4o6H1cQkEoqn+VL6zqPB4eY0AZd6ZVrqhH7EXPvNUz7JcbIx8wOzwdeIfB4+MAZaj1/WWod3ImAgFEpINmCjzuPO1428GZ+NOWL3Y05R3dLFDRExrnmVgxPCF+f6bLcfFelARvw4zphD8QFtIXl06w/MNTSL15IYzN+kOWLBGBVPeOFGwOgWODxCi7aaA+1CGaGDhUt2UheVtpF43Ar3yTf9aGUnxWgc1ulm5VN5rqD4jfrb0/QSHLjsYJhOM2Rjoq0skiU+laOMuCwrhNnhFIwfvu4E9rzHzoFOi6tMSeCzJ0lvaOPnhK4Iz3DG4X6qdpq8DztfpgbCcoXdjXV84HOxnZjODr03DRjvoBYNxMr/kQ8TlasHzO4iKhPi9ZHqskCenEDE+wbJfgmuo8WpoghP34AhhJldr8lEFeB+j1y UC65TfLX PL5QrLvTGjA0CbHLmkXHsfhvCAwNb3QTe3ERvIB8hIN8ZZ13u5oTUV8IY1paso/ENDLEgC1JMHAeHo4vclXtX+HTwQfD7WQNrnZkgVMaLMAzk6zN+xh6bmTJdB1TMCP+Y1H60+tNCHMujq46ETdVydMfIhePAtHQnaPfgYyoWDOHxjcWlx8EsavVNGorWhpd0Dg5PFJBfVwS/95k= 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: Convert from page to folio within __do_huge_pmd_anonymous_page(), as we need the precise page which is to be stored at this PTE in the folio, the function still keep a page as the parameter. Signed-off-by: Kefeng Wang --- mm/huge_memory.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 4fc43859e59a..39c19c5345ae 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -656,19 +656,20 @@ static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf, struct page *page, gfp_t gfp) { struct vm_area_struct *vma = vmf->vma; + struct folio *folio = page_folio(page); pgtable_t pgtable; unsigned long haddr = vmf->address & HPAGE_PMD_MASK; vm_fault_t ret = 0; - VM_BUG_ON_PAGE(!PageCompound(page), page); + VM_BUG_ON_FOLIO(!folio_test_large(folio), folio); - if (mem_cgroup_charge(page_folio(page), vma->vm_mm, gfp)) { - put_page(page); + if (mem_cgroup_charge(folio, vma->vm_mm, gfp)) { + folio_put(folio); count_vm_event(THP_FAULT_FALLBACK); count_vm_event(THP_FAULT_FALLBACK_CHARGE); return VM_FAULT_FALLBACK; } - cgroup_throttle_swaprate(page, gfp); + folio_throttle_swaprate(folio, gfp); pgtable = pte_alloc_one(vma->vm_mm); if (unlikely(!pgtable)) { @@ -678,11 +679,11 @@ static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf, clear_huge_page(page, vmf->address, HPAGE_PMD_NR); /* - * The memory barrier inside __SetPageUptodate makes sure that + * The memory barrier inside __folio_mark_uptodate makes sure that * clear_huge_page writes become visible before the set_pmd_at() * write. */ - __SetPageUptodate(page); + __folio_mark_uptodate(folio); vmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd); if (unlikely(!pmd_none(*vmf->pmd))) { @@ -697,7 +698,7 @@ static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf, /* Deliver the page fault to userland */ if (userfaultfd_missing(vma)) { spin_unlock(vmf->ptl); - put_page(page); + folio_put(folio); pte_free(vma->vm_mm, pgtable); ret = handle_userfault(vmf, VM_UFFD_MISSING); VM_BUG_ON(ret & VM_FAULT_FALLBACK); @@ -706,8 +707,8 @@ static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf, entry = mk_huge_pmd(page, vma->vm_page_prot); entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma); - page_add_new_anon_rmap(page, vma, haddr); - lru_cache_add_inactive_or_unevictable(page, vma); + folio_add_new_anon_rmap(folio, vma, haddr); + folio_add_lru_vma(folio, vma); pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, pgtable); set_pmd_at(vma->vm_mm, haddr, vmf->pmd, entry); update_mmu_cache_pmd(vma, vmf->address, vmf->pmd); @@ -724,7 +725,7 @@ static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf, release: if (pgtable) pte_free(vma->vm_mm, pgtable); - put_page(page); + folio_put(folio); return ret; } From patchwork Thu Mar 2 11:58:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13157123 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 984AEC6FA8E for ; Thu, 2 Mar 2023 11:37:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A21046B0073; Thu, 2 Mar 2023 06:37:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 746086B0080; Thu, 2 Mar 2023 06:37:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5713A6B0078; Thu, 2 Mar 2023 06:37:50 -0500 (EST) 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 3684C6B0073 for ; Thu, 2 Mar 2023 06:37:50 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0A23EA0583 for ; Thu, 2 Mar 2023 11:37:50 +0000 (UTC) X-FDA: 80523758700.03.8BDE63E Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf17.hostedemail.com (Postfix) with ESMTP id DC30540018 for ; Thu, 2 Mar 2023 11:37:46 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=none; spf=pass (imf17.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677757068; a=rsa-sha256; cv=none; b=2egUcMbGFZShyYxSs8pWZw02u40F6BQy35DOpmuocfEDAZxha4Q5Q4VnllpkWvyW8kEHXT S0Cid8SURJTBhrdZgAExK3Dv6bVmMJUfmlu36upyygS6IxH4lRciVtvIDWtJDogPloGICm P71aq3zWhxuUL8F1c6a0IAkqQv4Ss/s= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; spf=pass (imf17.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@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=1677757068; 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=uOkuypChHkNzLDRkvBZ73ca7PoMUKGQbSLHqhs0FKLY=; b=4e6VwJfLzk6ly3p9xT2sKbp40n5GkL6dztSH6Z5Rx9JniYcgql2+b+7Vet/E+1NzEVF8bU RfXh9ZoL9L6K/05KzSDHZCt3vZnlcWTtLtIftnvDZ410mbHBaZ9UXag4lQO91P41GxpFpk OVuWRHdb8RTxQDJuRhcDzBICtYJzI2k= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PS8Cn54NTznWGX; Thu, 2 Mar 2023 19:35:01 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 2 Mar 2023 19:37:42 +0800 From: Kefeng Wang To: CC: , , "Matthew Wilcox (Oracle)" , Kefeng Wang Subject: [PATCH v2 2/7] mm: memory: use folio_throttle_swaprate() in do_swap_page() Date: Thu, 2 Mar 2023 19:58:30 +0800 Message-ID: <20230302115835.105364-3-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230302115835.105364-1-wangkefeng.wang@huawei.com> References: <20230302115835.105364-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Queue-Id: DC30540018 X-Rspamd-Server: rspam01 X-Stat-Signature: zkiw8za68y9ufb4o8gjqtamwek13a6uy X-HE-Tag: 1677757066-602575 X-HE-Meta: U2FsdGVkX1+YArL8x9hSBtBoQOSu43Zw3BP56KSdEA0GksMmlxQWO52r+KB8Hz6jLg2jInRDdlB+tAPiyvNRJhHoqfSporueKMLZVAIS/0QfHiCN/ng/vMT+FU5w8L1s2GTg117DGhcAMuLbktYp7Wa2NjvQza5WMQ3mGGMCDDgXlNTtHxtNscojmVqADWBPzgOgHLwLS24NNcZusJ17wlvlh+qGCPXXbT7GqkySloZtzd92CzD0fXXmvnkYWC+pOlcRrmisYmPCbOuZOVZ/Y5J6Lf9ynyUM9/nAwXkDbKTrvc8SjRurr2W/o0VTglkYMXMbuQMlAOO835J4Lp5/43CYxev/OJ/PLKJFSXK/yaw0pUTsHTEamOw2V3Zzi6GEweIcrBinHfXYXUUcAOSa9ejF6ECGt39uMJFtc7nL87+xFmcPiQwg7Up92Q6B1rjGZqLvinY0HeKt5V/eBPkJwfGOVSvoPsaSJohRKJ7t16HYHGqxv9KkGpovddOaIKgv/WaVFDs/069OicdzbZqTO4XAHcB2eiB7n8W07h449OsmZWrdhVT1uRw4J3tPqX+SCTuOf2utOvqsxfZHTimBrF2jo0fPSBp2xDQV1Oc4REfeHpOZykSExwholBTF/7eP99zmZn6fWedXxcRbLUosgpuvjiJPLc1NOjFRgEF1L66BEY2ayVGts6rhf6IJEUGf4BCeug7sr4hTwE940WyiLNzvh/PGLdTHOkQ5PwndSIQ/CqCn6SOQwqA6npyp8p5kP3Mx1ad0QoWKnf/GbFVU5vP7ZpSDMikNDejvPgqtKqpr7sfti4GmoSr0Ro3S0IIxqFH58RIg7WMxkQqaNhsf6H/h/pBkjUgKSXTqnbg69ZB8JDwhC9cMmL0krk/5WbFcsfZIT19/ctC9P0/V+BW+69sVkBWrTau84fxXMfeopovuSnClUeuTpu0anjS/YDRNzb6EPy1q1xXoUYaOnrK /TbhcypB +CzP/QjJ/PiBTf5uYVlayP9DxLV/IYkt+tjUXSLTwBR07L6lkj+MlYl4MpE2Fy4VyJTGrj5Au83sYn0CLDBGesmV8rTydgepAvEystK/p8sxJbxomtE/ali1O4XIAIUo+r4VpNgNwr2iOmjt1Bj8bAc+VFWzL1FveBXbo8Ju3QgwBfqhs3Phja0FTeaDDz9gYLyh72ddr5wCYn60tqtnMbT6wcA== 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: Directly use folio_throttle_swaprate() instead of cgroup_throttle_swaprate(). Signed-off-by: Kefeng Wang --- mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index 255b2f4fdd4a..948fdcd4d8bf 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3848,7 +3848,7 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) lru_add_drain(); } - cgroup_throttle_swaprate(page, GFP_KERNEL); + folio_throttle_swaprate(folio, GFP_KERNEL); /* * Back out if somebody else already faulted in this pte. From patchwork Thu Mar 2 11:58:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13157126 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 7FFC5C678D4 for ; Thu, 2 Mar 2023 11:37:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0C6656B0078; Thu, 2 Mar 2023 06:37:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CEE9C6B007D; Thu, 2 Mar 2023 06:37:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A79F06B0074; Thu, 2 Mar 2023 06:37:50 -0500 (EST) 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 6B7F16B0074 for ; Thu, 2 Mar 2023 06:37:50 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 3813C1A10DD for ; Thu, 2 Mar 2023 11:37:50 +0000 (UTC) X-FDA: 80523758700.05.C4FD421 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf15.hostedemail.com (Postfix) with ESMTP id CFFD0A0002 for ; Thu, 2 Mar 2023 11:37:46 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677757068; a=rsa-sha256; cv=none; b=zLLnEgXk3ombeSyuJin0uqAGRhvT2O6etA0OQW9vfssGFWiN2tVtqpZamjlt1ayTKJg9uU ksHrRjQ7Gibx2qzFlHEAZ5cHyMHBYjWPNayd9VSL/5+Mm8nwNXyuJD1QH8Gg6KxXT3tHvr RA4otV5JA3DjX9EfiCCa0JAEBZaeBOM= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@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=1677757068; 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=gwhng07azqRhfhOC4+3UGmwycg/hm8zwc4Xg/sEtDWs=; b=mZwOLiy+mQO2tjUaBEszNcuEaVqA9TEC29SLeOjSH2d91aT0yRBFoXnSULnMFBaaOZbkdm fOXkr7LIDXoSF8ve9D0kPityaEbAjkckQaJRSrkomCE0vzwY3gG33zo0d7SxqFPxzX3R7R APAxAguir6d86Y9F3pfYT6n32vQkvoo= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PS8G65pX8zqVBq; Thu, 2 Mar 2023 19:37:02 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 2 Mar 2023 19:37:42 +0800 From: Kefeng Wang To: CC: , , "Matthew Wilcox (Oracle)" , Kefeng Wang Subject: [PATCH v2 3/7] mm: memory: use folio_throttle_swaprate() in page_copy_prealloc() Date: Thu, 2 Mar 2023 19:58:31 +0800 Message-ID: <20230302115835.105364-4-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230302115835.105364-1-wangkefeng.wang@huawei.com> References: <20230302115835.105364-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Queue-Id: CFFD0A0002 X-Rspamd-Server: rspam01 X-Stat-Signature: cpxbhwj5uequbiaggga6fnrp5wbsz94e X-HE-Tag: 1677757066-971882 X-HE-Meta: U2FsdGVkX18btHAJZ2y3PBcQjsctE31oDpeClDvgu8ujmdVgA/HwM+9R0EaUxVPnaY79bS+eHl4gqE+pkV3qhWpGUx3iyfNtKZ2OLrWzDQ84HFGkjlFnf5wbN/CqCBcOEHLoS5zSmPzVMCDIwi0uxqZcc5SPwKx5/mwEJ64Lf7PeJRXgVKgkoihMbAKbC0eSuPPbntkv/tRaXxihQfTHrPpbywOW+aYLB2uqC797MxVHWzx+ZA/kmayj8pkmaNV/SYXZn8IrUsH2TRbi1HljcUb8VSnw621DP0T4Czb5soBwLHhAvxoswHm286E1hXm+kzxWa1iekeZxR3FC5GWJ1a/aGHQvmCJ8TPlSWJ+YTBp0jQ0GXFzzUcWt8N2Fc/6cHs8B7AsakFDXDOOh7uNw01+Yr8O/OC1o0I7b+IIoRkERjU4r53f3Y71nnMwtQpJ743iF1cvHUA2oMChnzvEYaYR8mPMdOhqzgeNaLT7bFzm8NTX5FE8rtefur0glqWavdFVjHYfYAehMsOO7bTNs92+u/8AdnEXNbsPhfACmU7Ik2ZI0zZIkUGh1bI3IX98SQpFokDBAm6xLdHuExUhr0Rh74I96vWztg/I+qL//DZH8TWx9tz7BKxiyOEHDEB+YuXoROfCj+McC4Fdw4fboKVg5Kouy8DXpupVoQZxZCJVmSGGBX16CkjI+QxSQdNp2lhmtGy1cVJsWa5hnhDjP+moddJjvliAQD2NdSZr5w9N9kWkYgjtXT6vviT1+FuKs00DMb7VnzrM9lh6WYiwsDXeNd9lEElYjpv2KihGzSVtQUWtqL/Qt8xSIocQ4XfFoXOZU4C/aCAAxDjY6rYW503AfUwHXBARS65+xkfs71X+zCS6jFVv/WQuMOSZ3Jy529CnqbHCQH2v/a7eF2icAGBgFZTxPPxOehH5YHmT4u3gyvEhT0D/GHBgXtZI8FmrTf+hEB57ZebSbsiaRJ/J /S9R0PeH EfuTpChzetthrK+QepkDHLfyL9pF29VmYTvpcTmCaXc2hNTJbTHBcxVQMN7KDOKETl0EZLUs1vDbc37UGLv0vc6DyPCMJFehIoXJ73Dv16yvy7m+RJhiUU22bwv+ykPw9JwXg3unQlj/syGoAE5lF1D/qbqtpoQYijobTPwqNJNWXFRF7w5fQ6woKFzRyf/hmuAKBXzhX0DeRcp6ZeWCNjBoG3g== 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: Directly use folio_throttle_swaprate() instead of cgroup_throttle_swaprate(). Signed-off-by: Kefeng Wang --- mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index 948fdcd4d8bf..b5c87682bb17 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -974,7 +974,7 @@ static inline struct folio *page_copy_prealloc(struct mm_struct *src_mm, folio_put(new_folio); return NULL; } - cgroup_throttle_swaprate(&new_folio->page, GFP_KERNEL); + folio_throttle_swaprate(new_folio, GFP_KERNEL); return new_folio; } From patchwork Thu Mar 2 11:58:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13157122 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 ED46DC678D4 for ; Thu, 2 Mar 2023 11:37:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7F9D36B0075; Thu, 2 Mar 2023 06:37:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6355B6B0073; Thu, 2 Mar 2023 06:37:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4ADDF6B0074; Thu, 2 Mar 2023 06:37:50 -0500 (EST) 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 1D8FE6B0074 for ; Thu, 2 Mar 2023 06:37:50 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B88DD4104A for ; Thu, 2 Mar 2023 11:37:49 +0000 (UTC) X-FDA: 80523758658.07.B7B0E48 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf20.hostedemail.com (Postfix) with ESMTP id EBE5B1C0009 for ; Thu, 2 Mar 2023 11:37:46 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@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=1677757068; 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=mBga8Nh2s/en48NKxOgUMy6LMXaVRAT4FO7ZiNK6SaY=; b=ZGc/BW9ot0OXTFwwbCt9pdKVuq7XM0xXlygPJS7KHcIrXh/GdiGY0Se3siS163r0g/L7g5 vCpXJ+cYbbUD2eql3JDCBiiG4E8tDA6F1ZDFpfYyPVUhlMlmIoKUSEotvbbMm33Ck0yC8G iaoj8UhugyHEP2z58Cw4HjXY7aiTJFs= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677757068; a=rsa-sha256; cv=none; b=QxBc8zFWdJWikzSKdD1h3+rKdDbTqb2jecfh6VvatEs2cE+iA/sUJU9lDx760Wqhz2SIEH dA6+AAUsHzWxlQ+Ju275JfxOWgAqykRsa12IWMvf1WDeORKsvf48L5JzAp+BbVeNLpTaKD 4yAinRkxp1L7ZOH2VoG7Io0eo86U1xo= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4PS8974QG1zKmR7; Thu, 2 Mar 2023 19:32:43 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 2 Mar 2023 19:37:43 +0800 From: Kefeng Wang To: CC: , , "Matthew Wilcox (Oracle)" , Kefeng Wang Subject: [PATCH v2 4/7] mm: memory: use folio_throttle_swaprate() in wp_page_copy() Date: Thu, 2 Mar 2023 19:58:32 +0800 Message-ID: <20230302115835.105364-5-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230302115835.105364-1-wangkefeng.wang@huawei.com> References: <20230302115835.105364-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Stat-Signature: kwwhqrjey61on7e6nzcj371echzzgz19 X-Rspam-User: X-Rspamd-Queue-Id: EBE5B1C0009 X-Rspamd-Server: rspam06 X-HE-Tag: 1677757066-161033 X-HE-Meta: U2FsdGVkX19P1AzoMTAp6CR2rLtVWq+ulXHGsExIEMFjxMCtgph/CSqUsfHFBFrsu3iz+Gpq79FDGzXzqF7DgSZXqms+sUoQOiu5yEpj9B/ZbkXZLhQ7NoRGTj030e6l7oP7S0C6aWL/YsW86jCSfFBjgYiFPilPaVSG5VWWp/arXqOi9DGTdygyX6hQNUdaj//kG6+UxMA7soZTTd6rC1IhQ4n276O/qF46GSHKKkvJL4yiTHouQMhFLTHUSOBGaIct1zqon8rQJDtwQyJpOf1+mxtUcLDdCUEkWaLnm2xGGg1jiECXzsxNgniSb867KqGTW83T4i8540iSo5cu61cL9h/+0DF0OEH4i8oq1LW1DEEfakcEMeLFFGGxam8r4p2Or3bBwVplnJqkvD1y1FI2CyRI1/0/qtM9opn75JuNoWCdCIVFiZJVp98lMb8CnxhEb8obKq2V6+9znpbPoiiG+754gs84Bx0CIPgTtBKZ12LdJkq8r6yLjEodlFluhGzXnNplUu/baPCWm7m0/K9onSfmNL2GKGTcmZQU1HV16IaEi0NUr2yGCK6BzRs1obMRIIwf6XuWwyhr7kmzm9Yg5FEU3dJYTrgqcKqsxY1bGmfk300LdB/oSw6Z+Mn7HfsCEz5FEe022bhOSNrE8cvt9mxHeKQzu8Foyrwbt0LDSFgzlDFil9Z1uhAyWiKh4vp3D9MnjDhRgTLcJ3hkcbCfyjOUxY3oDGApFir2Ipa41dbapg3GbwcCYa+GvOmC86hunReNJ6qpWo51yoVcwnSAk4HbypXDFzciVH32inAw4vD4xzAssegRvog9c/1/4bSdwhrkIVFVzdWMuZYJHF/nrczWWEdeOOqL/TwSNsJTc5Q/7NbXT15J45aWXwksCxZfgR6u/SuhQFhATk/hbaO34vWer5u52bgQW0jckimlNtLVZF5E98SH8u/GExSCXKxjg30RRdwk/eI/QZS ih2B2jhQ pcoQwG3Bva7Nl7c/xoFnpkCJlSwla/ZqRE47AQH9kydYHkX8RVD6WnTxEbF3SB0+KEPs65DytjFZuXJ0iy3QaAXnaIj9NPtJwKoscP1ZjHZSEke6iFF7COpqHM3iRc7+XRoImqfy5hqrLT/C8ADxjJBbv6WMvDMR4bnDZoGYo1TSsCJFnn4mkf4UyqNY2o++NYlNmjvgF27GlGU4wlFID/yYLFA== 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: Directly use folio_throttle_swaprate() instead of cgroup_throttle_swaprate(). Signed-off-by: Kefeng Wang --- mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index b5c87682bb17..e068635d21cf 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3096,7 +3096,7 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf) if (mem_cgroup_charge(new_folio, mm, GFP_KERNEL)) goto oom_free_new; - cgroup_throttle_swaprate(&new_folio->page, GFP_KERNEL); + folio_throttle_swaprate(new_folio, GFP_KERNEL); __folio_mark_uptodate(new_folio); From patchwork Thu Mar 2 11:58:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13157127 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 A07BDC7EE33 for ; Thu, 2 Mar 2023 11:37:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 60F136B007B; Thu, 2 Mar 2023 06:37:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 572996B007D; Thu, 2 Mar 2023 06:37:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4123D6B0081; Thu, 2 Mar 2023 06:37:51 -0500 (EST) 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 3305D6B007B for ; Thu, 2 Mar 2023 06:37:51 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id ECDE01A1064 for ; Thu, 2 Mar 2023 11:37:50 +0000 (UTC) X-FDA: 80523758700.26.8A56324 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf25.hostedemail.com (Postfix) with ESMTP id 84481A000E for ; Thu, 2 Mar 2023 11:37:48 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677757069; 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=C9B8tPfbJgxpy1FGc2CFBjsvTKU83yOYpL9R3XfEe7M=; b=a3pDsVzYAEHeNajcPniqfvQHxg52DhM75rc4ewxyt8fJF+4xbyUHGw4IVtzQaenZ7lxm4k NAsqNBIOUwJ136aOYbi2IQbtmgMxtXav8jO1AHbGbXo7GlOQK9QXq0ZlgNHYhMaSKaPmQY 2Kcb42sp76AIvah4UZkDF6RgcNJKt/s= 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 wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677757069; a=rsa-sha256; cv=none; b=K9qmQmiGu4uUokOMkcTEjCxdUi8jkMClifpgk9K5+QwYsrcASpED4UJBvWbnzrj3IjZX+Q NwCI8lkgpIKVKdAlwRj4xFQhn8zP7Z/r9K5Hjoqrh4GVEY/vWjirZWReW3DP0JS+KmriYA 9C7il1/MH9bq+D7KF1T1qfRkAA7leEo= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PS8G7442ZzqVFL; Thu, 2 Mar 2023 19:37:03 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 2 Mar 2023 19:37:43 +0800 From: Kefeng Wang To: CC: , , "Matthew Wilcox (Oracle)" , Kefeng Wang Subject: [PATCH v2 5/7] mm: memory: use folio_throttle_swaprate() in do_anonymous_page() Date: Thu, 2 Mar 2023 19:58:33 +0800 Message-ID: <20230302115835.105364-6-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230302115835.105364-1-wangkefeng.wang@huawei.com> References: <20230302115835.105364-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 84481A000E X-Stat-Signature: cxneopxnxbzdwxsm66c915k3zhrppzt5 X-HE-Tag: 1677757068-350873 X-HE-Meta: U2FsdGVkX1/3aXKIOQh7jnK1gX3r3zwjjtSB5Sch6ovASOsUHFHCREVfKLuuKcRebBOugptgmsES1rQ6dgW+yydRsExq03FjtQZi0g+LZ4dbU7gqtL9+YSNTvLJECffQU54cTzOOlU+bkigWQH8os+eEM6L6MWydYSnzpADKEYJXLrZyZZD6YdjNZ0oWeoO8ib8Dhl6dwD8bbiHXIS31m6c+XRgoHkf+boyIg1FPtBpJKEir+Mj0fx/+/y71kVBB2Cbas0gNRfiUCklhBNCzGi1DmSvjxIo/6pyJM3fbr003QdCLTLXkahSRupnidoe+ovKEawrAgFYpMB5j1nyNUcEZXGjoP/nwEwq3caRAEiu1Dtj7XDTIbq4KrT+YXIN8zECr2d4HHqYuoMfogJjTm0gKopdD8NQsrq/LPmMkMw5vxvwzVjxvVmLV/ogb2nzb4KHZkfHnsoaiQO9yTyzHjojYbS6zUSpNgBhwS49XTpSqCdxxp4hss9XcXX/6ZuTxE06eshxfYNzDbPo0D4AkrXmd/RXslen1UB/VRu08N1AwJT0YN/lXsjovDDJ3DEyfyD76zB4pqvqMDtcZiNWRRuM21fTQoVWXFl4QsbkjJXz8SnorFLkKi/BMEmPHmp8vqp8uREKnqJxo7Fl7KOxFX/oToyDkqG9w1C68WS7gcQBXBDE6egpz2SguCBLDm0yipEsZpaILUTfR6NGhEValhD5tzAxUSpuEkPCrXosoqNTKSDoKSkCRGdaxAa/x4E9lc3Zn6ZNHLDPOi7kt/8AWynod8rzPzOYHYXBG5LT3louOwp2+yFRWsukUrOzmP9AAasbNITK+1eugcURLnlGsIFdtObQRABgMxPr3vncTQ5uVLmY9tGTFr2/tZs4Idx2tbQBVLBxjNTL8JWuUSOc4Y6uctWi1JiJO6tYbGU2mS80uWGFkrUMsNiQIqer3yc9L1ooOOLoJPRgIKAxtqvu NiHnFoGZ c0L2+qha1j89GaMuTVRK/6Y9RttmR8UHlhl20x5+icTlOKewM8N8Lh7Zy80wi1SKb6ECdfRN2Mcj5afj94RyA5bC69ijdHWsYaLQ5hlxlWju+P8GPkY8Uk9XKv+1zqW0oeq0GNplYW76ahVciGwRW04lTGWMXHIq7eaeWWBTNdw+bY/NIUNZ4V3UnoWZkxgd3KNZTA+BaXkm+bhZa3dK6MUbIBA== 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: Directly use folio_throttle_swaprate() instead of cgroup_throttle_swaprate(). Signed-off-by: Kefeng Wang --- mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index e068635d21cf..841737d5690d 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4065,7 +4065,7 @@ static vm_fault_t do_anonymous_page(struct vm_fault *vmf) if (mem_cgroup_charge(folio, vma->vm_mm, GFP_KERNEL)) goto oom_free_page; - cgroup_throttle_swaprate(&folio->page, GFP_KERNEL); + folio_throttle_swaprate(folio, GFP_KERNEL); /* * The memory barrier inside __folio_mark_uptodate makes sure that From patchwork Thu Mar 2 11:58:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13157120 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 9D5B6C7EE30 for ; Thu, 2 Mar 2023 11:37:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1397F6B0071; Thu, 2 Mar 2023 06:37:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0C38A6B0075; Thu, 2 Mar 2023 06:37:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EC0596B0074; Thu, 2 Mar 2023 06:37:49 -0500 (EST) 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 DDEF16B0071 for ; Thu, 2 Mar 2023 06:37:49 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B09EEAB782 for ; Thu, 2 Mar 2023 11:37:49 +0000 (UTC) X-FDA: 80523758658.07.5216578 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf27.hostedemail.com (Postfix) with ESMTP id 5AABE4000D for ; Thu, 2 Mar 2023 11:37:46 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677757068; 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=RV96LlTMyS60efsCIJSLjMlPFR7so6yuJxIK9Rv9A8E=; b=GOGYk/GJCyYYYmaGQyhedJIK8yMZwD8t8To8W4kgOW2gLnhk9uTkeNz68cWJNI2I4vOrQ4 P5aJ7scai7P3VsZiZVq7MsiqNTa4giVG/cAb+I74Gvhve/WtEQL3ldXHYG9CC2sM76Jxra FRG0GZ6N5pWIJo+VhHIepU/yKbPNf6Y= 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 wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677757068; a=rsa-sha256; cv=none; b=rYd4uJ/l4+PeMCaHDqhgaJ2B8ASVpo3jVElUHs4l8m1HoN8MXQS3i3erkw0J+cctDtLbCI 5NnL1mOkclGGvrtYkURDMHvTF8Ca6iWZ0k7HS1Gq2M1fk8pnAatmB6XU1DxQVzWz4Mw0LO P/ODT/cL7d5TgkfuAvOeb4QG+OujUP8= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PS8CX2XSLzSkTR; Thu, 2 Mar 2023 19:34:48 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 2 Mar 2023 19:37:43 +0800 From: Kefeng Wang To: CC: , , "Matthew Wilcox (Oracle)" , Kefeng Wang Subject: [PATCH v2 6/7] mm: memory: use folio_throttle_swaprate() in do_cow_fault() Date: Thu, 2 Mar 2023 19:58:34 +0800 Message-ID: <20230302115835.105364-7-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230302115835.105364-1-wangkefeng.wang@huawei.com> References: <20230302115835.105364-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 5AABE4000D X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: 5m1mdgny8m1tzgr19wozhay5kifqfuiu X-HE-Tag: 1677757066-869381 X-HE-Meta: U2FsdGVkX18XXkV+SJ4FqqJBA/QgyooZiZZDM9x9VnR/YixhOPvobb+yzDePWZofVfrS68ML9BRl2Z5s1Uog1e7aDPGM7HElQn4JEJFuzmuBKdcPIQh5lh5H3eR5nJu+biNyY4GrSEMbXjbsqYSeX/uCxw9OxWoh3LoU021l8Cqm5GaWSUBAaqASWNcIYJ8u2U7DfgwxcaOAiyFy+ADUU2kWJYenohWDajaZECbEhXlLn+OiZUbqf5lQyVaxpRTzFWfZYXivl6iWaje9t065K9V4I7xl/y5zjByXFwi8+ZD4+EGcaf1LB4u7yM+M3hSlNSJBtYAnnPxvue5sHkGJXtDgR2ckh8SSE47x/6u3qoiy17WXQ5bKhvIpeSL62OjF6uvyqiDtfwOOnW9hTtEO2oNFPZHsheIoxf+h7Xhul8LJXyToJgUgT6bnHJfdqYxuzBXql+nq5y5LGG7qd0u6GDDSwSlR+zXyYtrEpJJ2UTPoi59gANmU4aWEo60dnYkpHV4I+J3aX0ODh3tlqJ8UPwnTkH7GyeWBVB6CdbJTC6pYNQ+03w7WB5WKBgDXv857qb1qq/1Zee3TnAnoeH7Ij/ytI4T/3Yud2yfUdcWErkbQU40ljFGZtj/qXWI18KAiYwi+FbwK74ffuu47afT3CPppBqte8PJq1TsuAnPbU69iNnGypAtIQL9lsEEJUVz/AYGTb2RPCqFxz4BJUKdzMEBUCTdVcrdBRr1ixb+ZEqKL35wlryfTD+smYOCaH5t/hOUjWZK27yJFX6K4OtecSz2MwRh/EInKIfuDZfRy5ehUSL6yMkGey0nifCEceaAIwPhtr7jtxbYwoIOXtZW6NgiycMWVO0WooO+hfz8pTbaI2XY5L1+jNYS6fzvpQtk4OHiBfUFPVoS29jqiuHvZUGmlK0teEu8p8d3GaIFKkDK3EE6XUttAQIt+Djdt6fTBr0m1AOy6XMItFaNgy0Z N63MWEb4 Zaz63cvBdOxRGBf4+HALDSs68JBysqW211RkxE+vIabnw4U1iHWzaN8UpHUW1XOVvprym73bp8YXAZlwWyufh05TpWlsOG0IiSsWVabgnkGH8XbYZ3nQh+ToOjR8z7GqafopBigPneFI9auXrUODySgnZ3i2AXxqUQce7sxhz5uQr42X9cJJpMJk6L+3wb/kjYpcGCWJtd0PBw6ivXv0cCd/0fg== 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: Directly use folio_throttle_swaprate() instead of cgroup_throttle_swaprate(). Signed-off-by: Kefeng Wang --- mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index 841737d5690d..b24c618d7348 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4527,7 +4527,7 @@ static vm_fault_t do_cow_fault(struct vm_fault *vmf) put_page(vmf->cow_page); return VM_FAULT_OOM; } - cgroup_throttle_swaprate(vmf->cow_page, GFP_KERNEL); + folio_throttle_swaprate(page_folio(vmf->cow_page), GFP_KERNEL); ret = __do_fault(vmf); if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY))) From patchwork Thu Mar 2 11:58:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13157125 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 51D66C6FA8E for ; Thu, 2 Mar 2023 11:37:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E7D9F6B0074; Thu, 2 Mar 2023 06:37:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BB5A86B0078; Thu, 2 Mar 2023 06:37:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 926C46B0082; Thu, 2 Mar 2023 06:37:50 -0500 (EST) 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 5A3696B007D for ; Thu, 2 Mar 2023 06:37:50 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3DFF3AB795 for ; Thu, 2 Mar 2023 11:37:50 +0000 (UTC) X-FDA: 80523758700.06.1BFAE32 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf30.hostedemail.com (Postfix) with ESMTP id 0656480011 for ; Thu, 2 Mar 2023 11:37:47 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf30.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677757068; 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=MT8g8OM8Vel3TPORPNPfgy9B22EuLNyDvXMXmK9mTog=; b=770L5dPJD3gpAWfCgo0qRTyOislXvJwt42j+QmT+VH1bOmy/QXUhswQ70Ej2fUrBZV4jCD f5IVUVLG/9QHHd0QeZamjghMn1KpoppRoDyNoSCgmDtApLAiiTNypWGRd1ScYQKpTmVlKj OX0HtrAQ+xfJPoQsBEhwtT3If5QzF6c= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf30.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677757068; a=rsa-sha256; cv=none; b=O4Y1PSPACRGPDWIgWGWB5sgqWbchHBV18EtHKJNMJ+0oV+MFtoUV3FTWWwrpZeREF4wZZh HNmQ6jIdJE0/PNGHGQsdculpb5RXSYa4VfrUA+x5IMEUh1HA4PhQw+pLiqsIQ/NpMpi9/y nyFCSyfWAnd8JqhtzBW8isoz91QDBH8= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4PS8985SQRzKmRb; Thu, 2 Mar 2023 19:32:44 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 2 Mar 2023 19:37:44 +0800 From: Kefeng Wang To: CC: , , "Matthew Wilcox (Oracle)" , Kefeng Wang Subject: [PATCH v2 7/7] mm: swap: remove unneeded cgroup_throttle_swaprate() Date: Thu, 2 Mar 2023 19:58:35 +0800 Message-ID: <20230302115835.105364-8-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230302115835.105364-1-wangkefeng.wang@huawei.com> References: <20230302115835.105364-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 0656480011 X-Stat-Signature: j6t44guhrokspox89mswbh3ufx94ubhh X-Rspam-User: X-HE-Tag: 1677757067-111501 X-HE-Meta: U2FsdGVkX180X5E03S4UQvlxjF8c9uaO9bDeBzS2kcOSq21lJ8/GEebIbpx9Gmc07za9NjwYnujRQbvNdErZm49tnDCiJGjXyJFU+63ynhc+CaJkxrnGPMSwOglLqLj1KTHvXIc4uAseSqg4SIrcZUnobQ+UaooeI/2u63BYqKn7AAXpz1gVw9o57SxLaUfKrhceiKVtZygkLaYE1vDAwvV0NOSfWwHBF3FzNwOUpjz0GGAOm4KrnTKKKHuKysGsMSh6rw0Gb9RFB3Tg28PMWXmUz/nySQSv3O8p+8/g54YO4HIuefpp/NBpfF2K5m9Jkbmdo+oazua8evIgCl+FURWp5ZFW+spKCruAyC0nROVlK1t48dzUqNgGjkIGHMtFI1pqpljpdRb7hunKxVzjZkJvkTDQzDdNcoJWUv4p9I+ullJrRkFa43cpijNnhiKMVvYyGdWRO06WBFPE+b/PmZcZ0rgcjE4uiougcQuROw8nWbJGyvXHfcOKAIunGWqoT0zVRRQGLzSqSnZZjMymkAt06qOc2EAPXzWM5wasb66zLv9Lkwqg8BhJbt2nSpNjUFgzRHkSHaUkoc9pWQOJ9/+obwlMN5tvZ3QBiG4rxLJqogjpL9OptcMqBMnFbTvQgoNaZtlW4tD/R1dPIqOHMtLH2qUG4McQ52CA5b6XFRbqH4HCcDOb/8jOC8fmX4Oij1ZoOHv8wVtYrpBiCFRa3jPGRuk53VoG7pSZs1IA1DSaT8hR+lr0E4QFejVzycIyn0fykN+BwbsQ2iLs6ElK9UYrgWgk+i/Tf0CO8tZnt5657YCMqsjn1T2a/AntDO5JLABtbtYjSpxSoMRPw5OpZ+qGJKbkc5tnCQclzfYLEVnjeeaSh9QbMhSAvzExGiksUCAy6cOzsFffhZF2U4TjhNmnxykh1bN4id1OnmfTashXClVh94gIwA7iA/sVzL/3rNgNZSeplm8NZIOPQ9R isH/Pn60 HElDkRQQ99V4c1tAHeCXRd6nyTt1n+VStMJKzzyZduqYYi4QeM9nyhj7PLdHv4mKpqdV+q6YOyxmuvM/RNDuN5M74beXPvqeCKZC7tphAGHTh/5MPBt5r1Ef/UeSdSdEWy+DPyvzR2X8gcmwimJaJOL8lQ8H6G8e531xo+XHAOBwlZSSEDRcjBdVWBNMXTdaRpm7uXP9AmS/a/BYgeqYZ/IWUag== 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: All the callers of cgroup_throttle_swaprate() are converted to folio_throttle_swaprate(), so make __cgroup_throttle_swaprate() to take a folio, and rename it to __folio_throttle_swaprate(), also rename gfp_mask to gfp and drop redundant extern keyword. finally, drop unused cgroup_throttle_swaprate(). Signed-off-by: Kefeng Wang --- include/linux/swap.h | 12 ++++-------- mm/swapfile.c | 6 +++--- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 209a425739a9..d5d0b54e90e8 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -641,22 +641,18 @@ extern atomic_t zswap_stored_pages; #endif #if defined(CONFIG_SWAP) && defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP) -extern void __cgroup_throttle_swaprate(struct page *page, gfp_t gfp_mask); -static inline void cgroup_throttle_swaprate(struct page *page, gfp_t gfp_mask) +void __folio_throttle_swaprate(struct folio *folio, gfp_t gfp); +static inline void folio_throttle_swaprate(struct folio *folio, gfp_t gfp) { if (mem_cgroup_disabled()) return; - __cgroup_throttle_swaprate(page, gfp_mask); + __folio_throttle_swaprate(folio, gfp); } #else -static inline void cgroup_throttle_swaprate(struct page *page, gfp_t gfp_mask) -{ -} -#endif static inline void folio_throttle_swaprate(struct folio *folio, gfp_t gfp) { - cgroup_throttle_swaprate(&folio->page, gfp); } +#endif #if defined(CONFIG_MEMCG) && defined(CONFIG_SWAP) void mem_cgroup_swapout(struct folio *folio, swp_entry_t entry); diff --git a/mm/swapfile.c b/mm/swapfile.c index 62ba2bf577d7..c1b97436f811 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3635,12 +3635,12 @@ static void free_swap_count_continuations(struct swap_info_struct *si) } #if defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP) -void __cgroup_throttle_swaprate(struct page *page, gfp_t gfp_mask) +void __folio_throttle_swaprate(struct folio *folio, gfp_t gfp) { struct swap_info_struct *si, *next; - int nid = page_to_nid(page); + int nid = folio_nid(folio); - if (!(gfp_mask & __GFP_IO)) + if (!(gfp & __GFP_IO)) return; if (!blk_cgroup_congested())