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: 63379 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4192341wrd; Thu, 2 Mar 2023 03:58:46 -0800 (PST) X-Google-Smtp-Source: AK7set9ssAWxgnDV0JZ4d8yK0rFE02uuj10SWg8E05x/PX4BEn55Gfi+uxcNbr19t7h0xzjNnIIr X-Received: by 2002:a05:6a21:78a1:b0:cc:2ed0:e1e5 with SMTP id bf33-20020a056a2178a100b000cc2ed0e1e5mr2289347pzc.13.1677758326130; Thu, 02 Mar 2023 03:58:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677758326; cv=none; d=google.com; s=arc-20160816; b=PGyc5q/iyZxT04UfuxqlSe1QdhMFj2Q93NM9dGJhsu/byx7xA/8+JB0UV6o00mQ9X5 0E1F35dErZe2hytmKOUeIcGS/DYAX6tt+7x0cdugkFJArNqHc8X9NiovBXp/m0LSiR+J jH79KaFnMagmIxJd5otMNEWFSC2zfoz90VbCPBFT43oZUhyIWkGaINXLENqipNZ9Icg+ Ds3XixWxBoGz0L1zWOrgMcAFc8Xkg5L/S8ID5A0C/6UWEAk1JFwsg1JOPqkHwuNtMHmg a6xsUmENvLYazE1IazrhSP5lWne1XhHbMKb/sKyhz9ZU37C3eW5oYlu5CrFngHl6MCWP 3nxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=xbLPhSiqjy6IWZ/qhYrXAG1DUxlcCUFQt7fRdvz4lyg=; b=GH5Ulcs8FG3Wx8ohnZ69/uNonbLEcfNxJsJ4LUdLrwfPS1YSLQd9OnKN3+BDhLFN+S LjNMf6MolcOzBLmz83nYHWX90VdBr729Fm3EsXdKUEqsNqBRG8J+Mg+oY1i5eN3qYqL4 JquzbOayQtJefN7I6ZEQ3pVhTSVSxgJNlE2P5ooeCMVuiq1q6s2XCbr+eoCJ6FyloxTQ NNWxqdNTMGSyoxdm2n6MEhZ3jKFWV1CAD3vhgRHYrWLDLFwQfz9yFtRyxCjHPlRzJvyz FNgxT8K09fjdtmfYdQw0t8L7rj5hWFI7m3yujbcO6WfE7ItAPHiSjrMgt2AH3l1YR5dT Ve5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r132-20020a632b8a000000b0050327dc6000si13560795pgr.822.2023.03.02.03.58.33; Thu, 02 Mar 2023 03:58:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229821AbjCBLyL (ORCPT + 99 others); Thu, 2 Mar 2023 06:54:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbjCBLyJ (ORCPT ); Thu, 2 Mar 2023 06:54:09 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 749A91ADFB for ; Thu, 2 Mar 2023 03:53:56 -0800 (PST) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759257114308253650?= X-GMAIL-MSGID: =?utf-8?q?1759257114308253650?= 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: 63373 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4186371wrd; Thu, 2 Mar 2023 03:41:56 -0800 (PST) X-Google-Smtp-Source: AK7set9a4Vh7bJEKkkXJue29Fcd5O3bkSehpGZvco0IQfWrHSer73rP9MU0DeLizgfTiwdFnh/4J X-Received: by 2002:a17:906:d28a:b0:887:2248:efd5 with SMTP id ay10-20020a170906d28a00b008872248efd5mr8834104ejb.77.1677757315536; Thu, 02 Mar 2023 03:41:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677757315; cv=none; d=google.com; s=arc-20160816; b=grLR5Vt7LmlTIqiD64Ck/2FhjSKwE1E7mVGbbSkRjHG29RAwaQ35zLpXwjn4ubOk+V lsmKsaJtilIFOmiI1/I11c9Odg/9rfimwxEwljggQYUL+Jvv8UG7JGl8mnPKrKh46ya1 W8didZ4yHOwyWmCwFEb/N0jub5iLOq4CWWvKn2w2M8vczW/Dv4WJ1cKCSE/LpuXLIN22 05p0Yv2MUMXUyQ1C54SdwBRQnLfPwhXaJjZTC1r0Oxc8/ARXJfz/rKrjWX+WCUPg6sah /nYzTRRMShIpxpn1Np7duhraUvoh7vcukTqYdfLrnZs6oHV/R6yrtIp/pakGlXPIHFlZ /vOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=uOkuypChHkNzLDRkvBZ73ca7PoMUKGQbSLHqhs0FKLY=; b=ALvWDjNTfxl1Z81y6HX5gwbOlZQKoIesk83U8bV7Ie+tBB3lg0JYGQI4/J/ARRYc2Y hiuw/kv+8vskEDxv5HIWlEt3PqStJT2CRq/wdcaLk4lZXhw8AI4FZ4oSRKMA5GdJKlJL DZ534by8t+nuemJ8gTQlVCmUiBpdpqdjiwE72R8H5bweh0pPeLgKARPu13h4oenHnjZv HTogaS2RS8uUtoJFuhf6bvFqiu7F/LpSgHOlU0FHCieWa57X5MkhUyf2cZ2lxL3sYMFO jfNjXTwVnfFHYyrbgkPDzTiq+bI/MHtdfN4EuLseI0U0YI5L/5zIq0c4uo7QiDK8X59f xIUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j27-20020a1709062a1b00b008b17dad2e3bsi16185890eje.246.2023.03.02.03.41.29; Thu, 02 Mar 2023 03:41:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229974AbjCBLja (ORCPT + 99 others); Thu, 2 Mar 2023 06:39:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229792AbjCBLjW (ORCPT ); Thu, 2 Mar 2023 06:39:22 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B540333459 for ; Thu, 2 Mar 2023 03:39:00 -0800 (PST) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759256054901036653?= X-GMAIL-MSGID: =?utf-8?q?1759256054901036653?= 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: 63371 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4185790wrd; Thu, 2 Mar 2023 03:40:26 -0800 (PST) X-Google-Smtp-Source: AK7set8vHNYmjQVGq8up010f3b89Gbn3eRenprBQAuiTFn3yv0nVYNTSN+Z8nEbSVHf0ep/dwUqU X-Received: by 2002:a05:6402:10d5:b0:4ac:b6db:3ed0 with SMTP id p21-20020a05640210d500b004acb6db3ed0mr10070258edu.39.1677757225850; Thu, 02 Mar 2023 03:40:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677757225; cv=none; d=google.com; s=arc-20160816; b=bD3ecbu83x6eEj1awfAv7w14fGN3KtdP/IuSxf5iVxmNjGdr1PYc2GypUBqcni9Grk FZLCtuScCNFpE76CmByuhkwdUnHzv91cROjtScpoGTCuu0nV5nvFbCisxy7y3rVeo6U6 4eZqP667u6t+cLI+HVNJkXC661IOxYa50dXv4hOv/woaBbb0Znfw0A6WUrSXKAWtoIj4 uaihvDkteySIl4lvB/Ikeo4nY7HwAhiE8oajuEL+ctjrqXRH00QYDxRDW7y1oeG8mHTc d1yTLG/q1/c73U6NrJT0bJMNPYY62PPIPISeKkuAcGGszebpLnMtL3GhB6Xc77pJtXMR iJsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=gwhng07azqRhfhOC4+3UGmwycg/hm8zwc4Xg/sEtDWs=; b=uMqnI+8+oR3qjx7TxH0wEiWaISFiSjxCNbwAOlIksokfX3P3zqrO3AdAHdfZ7CBrPS p+Tn2MD3agJ54G/pufYN9IW79jiE9gmliYqZ43p9aWS32BCA661gANoYdA2vFtBfEnOB 8dLQMsqQzPP3sdY3UgMz5jmUmtPkMn0OBD8WIbGc7Cm++gUSP4fnGZmM5Za+wVQBs9+R pCPpG2gPYqNngVQgm2PZt3CZCnZo0c1L3VydZZRP7iIVhwV4bIhq+VRIeIhV7dx4Hhiw 0uJ4vkXs9BbcU+F/0vMNBrHEGNe8hfrHT9EXWnyp8V2dB9cjX8tV5U6IPQKdxjmaY0Kq St8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m5-20020aa7c485000000b004ad7b12d236si6302895edq.318.2023.03.02.03.40.03; Thu, 02 Mar 2023 03:40:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229801AbjCBLjV (ORCPT + 99 others); Thu, 2 Mar 2023 06:39:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229719AbjCBLjQ (ORCPT ); Thu, 2 Mar 2023 06:39:16 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11CCF367D6 for ; Thu, 2 Mar 2023 03:38:47 -0800 (PST) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759255960609865831?= X-GMAIL-MSGID: =?utf-8?q?1759255960609865831?= 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: 63378 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4192335wrd; Thu, 2 Mar 2023 03:58:45 -0800 (PST) X-Google-Smtp-Source: AK7set91JAtbubvBBZ/nctDG5kL4rBn546bgxvY2yGq8qYBzz8o05vieq24t0bdbpPZZUPQ2Vx96 X-Received: by 2002:a17:90b:1a86:b0:237:8c64:a784 with SMTP id ng6-20020a17090b1a8600b002378c64a784mr11698605pjb.37.1677758325220; Thu, 02 Mar 2023 03:58:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677758325; cv=none; d=google.com; s=arc-20160816; b=lz5dKnWbaKeeDKFgwIVdWSyUKDfjIetM6qAifgEClifP7TzxR3HNWrd+WqN1EHlCin 41PRBoiHznpnom4w1nN1sGwL5CVmf7qYLTQCCvJuobSeemi/Bysp3ud+iCHrc+HyWmZJ atAh6WTQUgoy/qAIVswMeV6Z/Vh5v0lx/odujc8VHfQIvAS1F2HPP/wly+NIicIk9brq HaKNy56Xswof+RdR8TQmL0S2lZ5L89Oz9wPjJtadhQ0MEpczFzN97pWv6UvdUsFnD3rC dTCm5nGJTvNnPJIob3I7pEKcTqFt0Ghs/awcmcK6A3G/cF0e+EBMmAHKQ8B9IkROzFMv ASTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=mBga8Nh2s/en48NKxOgUMy6LMXaVRAT4FO7ZiNK6SaY=; b=BdCOkIdI0l03lKZCJ1qNfD2DVduZVhkblHiE3YmxrF9mFO/enOith10f2ipnRxMQbe geP0c/8KHtjrWpwscv5InTyovDIR4vAzIrTa8U6Lt63huGRjdt2XRZhTmmd72al+OTOg oyFMBDy6Ok+j5jCmcc4nJhTCfG+MUyXcmqZYYeXh2PkRIXBTcwAR4a4B7SEMAtrL4c3n 716ZArVAahYyF1HJ9NzrBZYjQwKCoLgE7xksT2YTb9l/Qv5e5I3SM2kD1/jkT3ZvTrnE pBzx8VxOGt5Pt1v8kD3Py+MeiR4gV+6+s758mN8QKnjYfXhBzkUMmFDmNFzDPZOX2XWz 6Lfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v25-20020a637a19000000b004fb83390415si2668337pgc.77.2023.03.02.03.58.32; Thu, 02 Mar 2023 03:58:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229513AbjCBLxp (ORCPT + 99 others); Thu, 2 Mar 2023 06:53:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbjCBLxm (ORCPT ); Thu, 2 Mar 2023 06:53:42 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 789CE17CCF for ; Thu, 2 Mar 2023 03:53:36 -0800 (PST) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759257113285989651?= X-GMAIL-MSGID: =?utf-8?q?1759257113285989651?= 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: 63390 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4203574wrd; Thu, 2 Mar 2023 04:20:50 -0800 (PST) X-Google-Smtp-Source: AK7set+Evkn3upkPtm7aTGTFXGc0vW26EWAPQH4oZPSKbcqdisT3ou4Lg4RB0haCpLVj3MczKg69 X-Received: by 2002:a17:906:36d5:b0:8f0:143d:ee28 with SMTP id b21-20020a17090636d500b008f0143dee28mr10950233ejc.16.1677759650543; Thu, 02 Mar 2023 04:20:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677759650; cv=none; d=google.com; s=arc-20160816; b=bW87DWrBbYSy3dJ/yRq5+iMvTmRlDTcej7ES319nTzyfx5MUpqIgKWsfKikVjXFaa5 kCd44e35f8oIOH62Vh0rfjdwwGhVY7PFFb2RMuHapZSQeW1dArzjRDnngWPuo+lRHx9A UXEWavrkLuOyNQv/aPjvrze05xxEqObbb7KOnNetjl6Id7YTLphZ0DZUlJJG0v3HdHhz mhMibMjFqj7KJS361IkAEDViN8ImWqGGxdUM6IAvpLoiRRd40gEN9Q/x50HH5v1VBJyn 4MJfDahnaoLhFzrXrxIcJS8+cTXJsWjzo+gtJE3tdMyXVAWpP7Vscginb+9pwowh3wZK YOaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=C9B8tPfbJgxpy1FGc2CFBjsvTKU83yOYpL9R3XfEe7M=; b=T2eHng5QvmL4YGJz6gLkGbSrFp/LEyXl+wKn3fRnYBWXPn/0oEbl2DACgXhLjg5zF0 affO4UoOa0qi7JDkVtnVUU6jgdTyWg/BZOQJpPJpcVvI4sLYfH+A2BGxYfNE8mmPOk4g xrrnOKC3ktVEpVW01dc6UJGVKdvlk9RjaVNNBgHvaIc8MW5L0SqxkgZKPAu5L5c8WALO 1U21/Mct39h08nQgWHRwDkeFg6c6TZZU6p7s9HU3MJp2uwX5GWtSwhK3bmffIm5/eAIo 6zs6C2pov+jjFdxnGPt6ie+iXagbv8pW8keGEyrcwuo1wRbQAbul0vx8f1Ztr+zov+L4 uDaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q11-20020a1709066b0b00b008d667252e7esi4630697ejr.11.2023.03.02.04.20.27; Thu, 02 Mar 2023 04:20:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229745AbjCBMAs (ORCPT + 99 others); Thu, 2 Mar 2023 07:00:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbjCBMAr (ORCPT ); Thu, 2 Mar 2023 07:00:47 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16FC9166FD for ; Thu, 2 Mar 2023 04:00:46 -0800 (PST) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759258503393164031?= X-GMAIL-MSGID: =?utf-8?q?1759258503393164031?= 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: 63372 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4186066wrd; Thu, 2 Mar 2023 03:41:10 -0800 (PST) X-Google-Smtp-Source: AK7set9gsDqRXclh2ePw0nC1uD7bhHdzuLMXBQGA7z4r1ebzrfRf6B2nSaYOqWHNOMCVnj54jB2M X-Received: by 2002:aa7:cd8b:0:b0:4ac:b309:3d76 with SMTP id x11-20020aa7cd8b000000b004acb3093d76mr9863437edv.31.1677757270710; Thu, 02 Mar 2023 03:41:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677757270; cv=none; d=google.com; s=arc-20160816; b=dCrbarIO75y5Ek0ylwuchdcvMMLOHTB4zDHrgO9UAM0qEM9EDkfdgpPS3SNkrU8K1L xvSFLEv3OBJeKmpXExAdHLlhZWDDDtq7RDITamdBxIj95y7SYgN8TrGRgbqxk4z6IghQ 1EvP87QrxxNuBjoCutQDMTuis4H3aTYhM9Dwdfc0E2iLlXwcCCJaMtzyllHOKrHOsXhl /6uSnqYHwbr/eKPJq3u2RQUGDmGHdnDZVyj6MnzZ150R7mD2D1yiEj5H2O5SUHUNyYHl dHCzesh1seEA5ZsTc0wSfsKidUOIbGPReb5fm5KBO/xy5Q50moSz7rbRQ/zY812ZO8TW ctZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=RV96LlTMyS60efsCIJSLjMlPFR7so6yuJxIK9Rv9A8E=; b=cHz7jbrkrCD2SFGu318672qpzwnLqnvW2C6UKeIrOE4CEI5vnCSyC9zQQn25jv0Y0J aKrEKI+DnCc5K29zGg3GfPWMOA7ggcDgpr3Zi4DJc3tonHCYAFnS4CKYfy6uREI7EmdX TTm2f8jRN9dqjdXjVRMLgKjLIBOHp13UKKINGlbld1D8Mas0Y4DedU/9NTsQ52NnFZc5 1aYIn39yyr5gWAdFy69Kv2mO37B8e4JAP0yjTHNzQRheWa0eo8INsl6n9CtJhM+jdJnX 0Wg/KkFFVg9T1J2LKE5yTMyAr+5iOCG6Sb2iAOZwN+n419NpdTrJDxY9BXSxoirpKMFg zhcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h13-20020a1709060f4d00b008dd491949d3si498615ejj.252.2023.03.02.03.40.47; Thu, 02 Mar 2023 03:41:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229668AbjCBLj0 (ORCPT + 99 others); Thu, 2 Mar 2023 06:39:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229760AbjCBLjT (ORCPT ); Thu, 2 Mar 2023 06:39:19 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B38BF2BF02 for ; Thu, 2 Mar 2023 03:38:54 -0800 (PST) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759256007907164880?= X-GMAIL-MSGID: =?utf-8?q?1759256007907164880?= 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: 63382 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4192589wrd; Thu, 2 Mar 2023 03:59:28 -0800 (PST) X-Google-Smtp-Source: AK7set9fJFFFmqCIItSRUaQj1BtPKyqI0/QdN/ZqlkvxxJ1ssuwYZf9d8rVEA1T1YwD+J30T2T5C X-Received: by 2002:a17:902:ea11:b0:19c:d5a5:1f52 with SMTP id s17-20020a170902ea1100b0019cd5a51f52mr12052343plg.18.1677758367940; Thu, 02 Mar 2023 03:59:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677758367; cv=none; d=google.com; s=arc-20160816; b=Q5qgY8P8kSwcOTgyED3JJcHhcgcT9McrCY7BgzNwRnSG2LE2YKnCF4yF/rEPnFRbrM qcIGhGzkMvU/w4t8Qa+A8kuSWjXcNveNgtmLWKXxwEaWGi7JWBf92Pe2XyrSlGWjZJUO 8e2USL95B5NMUhUBSj9V7E0amM/aU+YrX/0JZc+zGVHBl/HzidV+jjq/9oWmhziNt6ym 4P4iu924mpSc+dTa9d9p9N8P2N/EvgkE0pLm6VlAec0hkpIVcFvaVXtINP9E1eJTER8G oH1wnrTw6Wcryi+Dn/uLGygvGyhRezu6l8IBFaJe8eXsqnHrMacs/EKHvEZiZ+OCUssG Yh8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=MT8g8OM8Vel3TPORPNPfgy9B22EuLNyDvXMXmK9mTog=; b=Q06lc/KollebjIh0uXUjSVOl75oDEJAX7ID4O2XA4RFkkytIA1RLV+1GjsPVKnQO6F I9hwreAtNUwTE2DnS8xZAoweyMjAlHC1a7d85yuM0lTzOtwXqymGbwmo94hwGCMvN6yE oIislNQmRv0yugYTxIHHzXrR2KA8hpi/mveEybhltawXlJByY97a1d9ZjG+xXYQHol/+ uglcDDaPL9igJteWWpsCGM4njYHeGZyAlocPDq1Zvq5RanzvFHGP3ej/QObIBd9j86cx 7bA1GMPV6qdOvVTlU9aCmDhAMNdDUwL46XxJ2Ivu+cAvNcMEcB3I7VIG58PHwkN5yni0 JX4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kc8-20020a17090333c800b0019ac3233e25si15211796plb.21.2023.03.02.03.59.13; Thu, 02 Mar 2023 03:59:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229761AbjCBLxn (ORCPT + 99 others); Thu, 2 Mar 2023 06:53:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229513AbjCBLxl (ORCPT ); Thu, 2 Mar 2023 06:53:41 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77E5E1515D for ; Thu, 2 Mar 2023 03:53:36 -0800 (PST) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759257158656037638?= X-GMAIL-MSGID: =?utf-8?q?1759257158656037638?= 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())