From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BBF6C433B4 for ; Thu, 1 Apr 2021 15:05:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 88EB761364 for ; Thu, 1 Apr 2021 15:05:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 88EB761364 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B28E76B0074; Thu, 1 Apr 2021 11:05:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AB1BE6B007E; Thu, 1 Apr 2021 11:05:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 979826B0080; Thu, 1 Apr 2021 11:05:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0161.hostedemail.com [216.40.44.161]) by kanga.kvack.org (Postfix) with ESMTP id 76E746B0074 for ; Thu, 1 Apr 2021 11:05:13 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 2997BB9EA for ; Thu, 1 Apr 2021 15:05:13 +0000 (UTC) X-FDA: 77984121306.29.E622347 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf11.hostedemail.com (Postfix) with ESMTP id 7C5DD200024C for ; Thu, 1 Apr 2021 15:05:07 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0B72015DB; Thu, 1 Apr 2021 08:05:06 -0700 (PDT) Received: from [10.163.68.23] (unknown [10.163.68.23]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9D7083F719; Thu, 1 Apr 2021 08:05:04 -0700 (PDT) Subject: Re: [PATCH -next 2/3] mm/debug_vm_pgtable: Move {pmd/pud}_huge_tests out of CONFIG_TRANSPARENT_HUGEPAGE To: Shixin Liu , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20210401022315.2911967-1-liushixin2@huawei.com> <20210401022315.2911967-2-liushixin2@huawei.com> From: Anshuman Khandual Message-ID: Date: Thu, 1 Apr 2021 20:35:53 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210401022315.2911967-2-liushixin2@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Stat-Signature: 6yu3yw9a9roqtf8bassbmsk37ect19dk X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 7C5DD200024C Received-SPF: none (arm.com>: No applicable sender policy available) receiver=imf11; identity=mailfrom; envelope-from=""; helo=foss.arm.com; client-ip=217.140.110.172 X-HE-DKIM-Result: none/none X-HE-Tag: 1617289507-156178 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: On 4/1/21 7:53 AM, Shixin Liu wrote: > The functions {pmd/pud}_set_huge and {pmd/pud}_clear_huge is not depend on THP. s/is not depend/are not dependent/ > But now if we want to test these functions, we have to enable THP. So move > {pmd/pud}_huge_tests out of CONFIG_TRANSPARENT_HUGEPAGE. Please drop the second sentence here. > > Signed-off-by: Shixin Liu > --- > mm/debug_vm_pgtable.c | 91 +++++++++++++++++++------------------------ > 1 file changed, 39 insertions(+), 52 deletions(-) > > diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c > index a5c71a94e804..c379bbe42c2a 100644 > --- a/mm/debug_vm_pgtable.c > +++ b/mm/debug_vm_pgtable.c > @@ -242,29 +242,6 @@ static void __init pmd_leaf_tests(unsigned long pfn, pgprot_t prot) > WARN_ON(!pmd_leaf(pmd)); > } > > -#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP > -static void __init pmd_huge_tests(pmd_t *pmdp, unsigned long pfn, pgprot_t prot) > -{ > - pmd_t pmd; > - > - if (!arch_vmap_pmd_supported(prot)) > - return; > - > - pr_debug("Validating PMD huge\n"); > - /* > - * X86 defined pmd_set_huge() verifies that the given > - * PMD is not a populated non-leaf entry. > - */ > - WRITE_ONCE(*pmdp, __pmd(0)); > - WARN_ON(!pmd_set_huge(pmdp, __pfn_to_phys(pfn), prot)); > - WARN_ON(!pmd_clear_huge(pmdp)); > - pmd = READ_ONCE(*pmdp); > - WARN_ON(!pmd_none(pmd)); > -} > -#else /* CONFIG_HAVE_ARCH_HUGE_VMAP */ > -static void __init pmd_huge_tests(pmd_t *pmdp, unsigned long pfn, pgprot_t prot) { } > -#endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */ > - > static void __init pmd_savedwrite_tests(unsigned long pfn, pgprot_t prot) > { > pmd_t pmd = pfn_pmd(pfn, prot); > @@ -379,30 +356,6 @@ static void __init pud_leaf_tests(unsigned long pfn, pgprot_t prot) > pud = pud_mkhuge(pud); > WARN_ON(!pud_leaf(pud)); > } > - > -#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP > -static void __init pud_huge_tests(pud_t *pudp, unsigned long pfn, pgprot_t prot) > -{ > - pud_t pud; > - > - if (!arch_vmap_pud_supported(prot)) > - return; > - > - pr_debug("Validating PUD huge\n"); > - /* > - * X86 defined pud_set_huge() verifies that the given > - * PUD is not a populated non-leaf entry. > - */ > - WRITE_ONCE(*pudp, __pud(0)); > - WARN_ON(!pud_set_huge(pudp, __pfn_to_phys(pfn), prot)); > - WARN_ON(!pud_clear_huge(pudp)); > - pud = READ_ONCE(*pudp); > - WARN_ON(!pud_none(pud)); > -} > -#else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */ > -static void __init pud_huge_tests(pud_t *pudp, unsigned long pfn, pgprot_t prot) { } > -#endif /* !CONFIG_HAVE_ARCH_HUGE_VMAP */ > - > #else /* !CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */ > static void __init pud_basic_tests(struct mm_struct *mm, unsigned long pfn, int idx) { } > static void __init pud_advanced_tests(struct mm_struct *mm, > @@ -412,9 +365,6 @@ static void __init pud_advanced_tests(struct mm_struct *mm, > { > } > static void __init pud_leaf_tests(unsigned long pfn, pgprot_t prot) { } > -static void __init pud_huge_tests(pud_t *pudp, unsigned long pfn, pgprot_t prot) > -{ > -} > #endif /* CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */ > #else /* !CONFIG_TRANSPARENT_HUGEPAGE */ > static void __init pmd_basic_tests(unsigned long pfn, int idx) { } > @@ -433,14 +383,51 @@ static void __init pud_advanced_tests(struct mm_struct *mm, > } > static void __init pmd_leaf_tests(unsigned long pfn, pgprot_t prot) { } > static void __init pud_leaf_tests(unsigned long pfn, pgprot_t prot) { } > +static void __init pmd_savedwrite_tests(unsigned long pfn, pgprot_t prot) { } > +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ > + > +#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP > static void __init pmd_huge_tests(pmd_t *pmdp, unsigned long pfn, pgprot_t prot) > { > + pmd_t pmd; > + > + if (!arch_vmap_pmd_supported(prot)) > + return; > + > + pr_debug("Validating PMD huge\n"); > + /* > + * X86 defined pmd_set_huge() verifies that the given > + * PMD is not a populated non-leaf entry. > + */ > + WRITE_ONCE(*pmdp, __pmd(0)); > + WARN_ON(!pmd_set_huge(pmdp, __pfn_to_phys(pfn), prot)); > + WARN_ON(!pmd_clear_huge(pmdp)); > + pmd = READ_ONCE(*pmdp); > + WARN_ON(!pmd_none(pmd)); > } > + > static void __init pud_huge_tests(pud_t *pudp, unsigned long pfn, pgprot_t prot) > { > + pud_t pud; > + > + if (!arch_vmap_pud_supported(prot)) > + return; > + > + pr_debug("Validating PUD huge\n"); > + /* > + * X86 defined pud_set_huge() verifies that the given > + * PUD is not a populated non-leaf entry. > + */ > + WRITE_ONCE(*pudp, __pud(0)); > + WARN_ON(!pud_set_huge(pudp, __pfn_to_phys(pfn), prot)); > + WARN_ON(!pud_clear_huge(pudp)); > + pud = READ_ONCE(*pudp); > + WARN_ON(!pud_none(pud)); > } > -static void __init pmd_savedwrite_tests(unsigned long pfn, pgprot_t prot) { } > -#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ > +#else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */ > +static void __init pmd_huge_tests(pmd_t *pmdp, unsigned long pfn, pgprot_t prot) { } > +static void __init pud_huge_tests(pud_t *pudp, unsigned long pfn, pgprot_t prot) { } > +#endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */ > > static void __init p4d_basic_tests(unsigned long pfn, pgprot_t prot) > { > This overall does make sense. Will further look into this but later on.