From: Anshuman Khandual <anshuman.khandual@arm.com>
To: Gavin Shan <gshan@redhat.com>, linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, gerald.schaefer@linux.ibm.com,
aneesh.kumar@linux.ibm.com, christophe.leroy@csgroup.eu,
cai@lca.pw, catalin.marinas@arm.com, will@kernel.org,
akpm@linux-foundation.org, chuhu@redhat.com,
shan.gavin@gmail.com
Subject: Re: [PATCH v4 10/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in PGD and P4D modifying tests
Date: Thu, 29 Jul 2021 11:21:45 +0530 [thread overview]
Message-ID: <d373368a-52c9-30b8-5300-edaacad077ef@arm.com> (raw)
In-Reply-To: <20210727061401.592616-11-gshan@redhat.com>
On 7/27/21 11:43 AM, Gavin Shan wrote:
> This uses struct pgtable_debug_args in PGD/P4D modifying tests. No
> allocated huge page is used in these tests. Besides, the unused
> variable @saved_p4dp and @saved_pudp are dropped.
>
> Signed-off-by: Gavin Shan <gshan@redhat.com>
> ---
> mm/debug_vm_pgtable.c | 86 +++++++++++++++++++------------------------
> 1 file changed, 38 insertions(+), 48 deletions(-)
>
> diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c
> index 863871e70268..0611b5f31e89 100644
> --- a/mm/debug_vm_pgtable.c
> +++ b/mm/debug_vm_pgtable.c
> @@ -518,27 +518,26 @@ static void __init pud_populate_tests(struct pgtable_debug_args *args) { }
> #endif /* PAGETABLE_PUD_FOLDED */
>
> #ifndef __PAGETABLE_P4D_FOLDED
> -static void __init p4d_clear_tests(struct mm_struct *mm, p4d_t *p4dp)
> +static void __init p4d_clear_tests(struct pgtable_debug_args *args)
> {
> - p4d_t p4d = READ_ONCE(*p4dp);
> + p4d_t p4d = READ_ONCE(*args->p4dp);
>
> - if (mm_pud_folded(mm))
> + if (mm_pud_folded(args->mm))
> return;
>
> pr_debug("Validating P4D clear\n");
> p4d = __p4d(p4d_val(p4d) | RANDOM_ORVALUE);
> - WRITE_ONCE(*p4dp, p4d);
> - p4d_clear(p4dp);
> - p4d = READ_ONCE(*p4dp);
> + WRITE_ONCE(*args->p4dp, p4d);
> + p4d_clear(args->p4dp);
> + p4d = READ_ONCE(*args->p4dp);
> WARN_ON(!p4d_none(p4d));
> }
>
> -static void __init p4d_populate_tests(struct mm_struct *mm, p4d_t *p4dp,
> - pud_t *pudp)
> +static void __init p4d_populate_tests(struct pgtable_debug_args *args)
> {
> p4d_t p4d;
>
> - if (mm_pud_folded(mm))
> + if (mm_pud_folded(args->mm))
> return;
>
> pr_debug("Validating P4D populate\n");
> @@ -546,34 +545,33 @@ static void __init p4d_populate_tests(struct mm_struct *mm, p4d_t *p4dp,
> * This entry points to next level page table page.
> * Hence this must not qualify as p4d_bad().
> */
> - pud_clear(pudp);
> - p4d_clear(p4dp);
> - p4d_populate(mm, p4dp, pudp);
> - p4d = READ_ONCE(*p4dp);
> + pud_clear(args->pudp);
> + p4d_clear(args->p4dp);
> + p4d_populate(args->mm, args->p4dp, args->start_pudp);
> + p4d = READ_ONCE(*args->p4dp);
> WARN_ON(p4d_bad(p4d));
> }
>
> -static void __init pgd_clear_tests(struct mm_struct *mm, pgd_t *pgdp)
> +static void __init pgd_clear_tests(struct pgtable_debug_args *args)
> {
> - pgd_t pgd = READ_ONCE(*pgdp);
> + pgd_t pgd = READ_ONCE(*(args->pgdp));
>
> - if (mm_p4d_folded(mm))
> + if (mm_p4d_folded(args->mm))
> return;
>
> pr_debug("Validating PGD clear\n");
> pgd = __pgd(pgd_val(pgd) | RANDOM_ORVALUE);
> - WRITE_ONCE(*pgdp, pgd);
> - pgd_clear(pgdp);
> - pgd = READ_ONCE(*pgdp);
> + WRITE_ONCE(*args->pgdp, pgd);
> + pgd_clear(args->pgdp);
> + pgd = READ_ONCE(*args->pgdp);
> WARN_ON(!pgd_none(pgd));
> }
>
> -static void __init pgd_populate_tests(struct mm_struct *mm, pgd_t *pgdp,
> - p4d_t *p4dp)
> +static void __init pgd_populate_tests(struct pgtable_debug_args *args)
> {
> pgd_t pgd;
>
> - if (mm_p4d_folded(mm))
> + if (mm_p4d_folded(args->mm))
> return;
>
> pr_debug("Validating PGD populate\n");
> @@ -581,23 +579,17 @@ static void __init pgd_populate_tests(struct mm_struct *mm, pgd_t *pgdp,
> * This entry points to next level page table page.
> * Hence this must not qualify as pgd_bad().
> */
> - p4d_clear(p4dp);
> - pgd_clear(pgdp);
> - pgd_populate(mm, pgdp, p4dp);
> - pgd = READ_ONCE(*pgdp);
> + p4d_clear(args->p4dp);
> + pgd_clear(args->pgdp);
> + pgd_populate(args->mm, args->pgdp, args->start_p4dp);
> + pgd = READ_ONCE(*args->pgdp);
> WARN_ON(pgd_bad(pgd));
> }
> #else /* !__PAGETABLE_P4D_FOLDED */
> -static void __init p4d_clear_tests(struct mm_struct *mm, p4d_t *p4dp) { }
> -static void __init pgd_clear_tests(struct mm_struct *mm, pgd_t *pgdp) { }
> -static void __init p4d_populate_tests(struct mm_struct *mm, p4d_t *p4dp,
> - pud_t *pudp)
> -{
> -}
> -static void __init pgd_populate_tests(struct mm_struct *mm, pgd_t *pgdp,
> - p4d_t *p4dp)
> -{
> -}
> +static void __init p4d_clear_tests(struct pgtable_debug_args *args) { }
> +static void __init pgd_clear_tests(struct pgtable_debug_args *args) { }
> +static void __init p4d_populate_tests(struct pgtable_debug_args *args) { }
> +static void __init pgd_populate_tests(struct pgtable_debug_args *args) { }
> #endif /* PAGETABLE_P4D_FOLDED */
>
> static void __init pte_clear_tests(struct pgtable_debug_args *args)
> @@ -1212,8 +1204,8 @@ static int __init debug_vm_pgtable(void)
> struct vm_area_struct *vma;
> struct mm_struct *mm;
> pgd_t *pgdp;
> - p4d_t *p4dp, *saved_p4dp;
> - pud_t *pudp, *saved_pudp;
> + p4d_t *p4dp;
> + pud_t *pudp;
> pmd_t *pmdp, *saved_pmdp, pmd;
> pte_t *ptep;
> pgtable_t saved_ptep;
> @@ -1258,8 +1250,6 @@ static int __init debug_vm_pgtable(void)
> * page table pages.
> */
> pmd = READ_ONCE(*pmdp);
> - saved_p4dp = p4d_offset(pgdp, 0UL);
> - saved_pudp = pud_offset(p4dp, 0UL);
> saved_pmdp = pmd_offset(pudp, 0UL);
> saved_ptep = pmd_pgtable(pmd);
>
> @@ -1338,15 +1328,15 @@ static int __init debug_vm_pgtable(void)
> pud_populate_tests(&args);
> spin_unlock(ptl);
>
> - spin_lock(&mm->page_table_lock);
> - p4d_clear_tests(mm, p4dp);
> - pgd_clear_tests(mm, pgdp);
> - p4d_populate_tests(mm, p4dp, saved_pudp);
> - pgd_populate_tests(mm, pgdp, saved_p4dp);
> - spin_unlock(&mm->page_table_lock);
> + spin_lock(&(args.mm->page_table_lock));
> + p4d_clear_tests(&args);
> + pgd_clear_tests(&args);
> + p4d_populate_tests(&args);
> + pgd_populate_tests(&args);
> + spin_unlock(&(args.mm->page_table_lock));
>
> - p4d_free(mm, saved_p4dp);
> - pud_free(mm, saved_pudp);
> + p4d_free(mm, p4d_offset(pgdp, 0UL));
> + pud_free(mm, pud_offset(p4dp, 0UL));
> pmd_free(mm, saved_pmdp);
> pte_free(mm, saved_ptep);
>
>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
next prev parent reply other threads:[~2021-07-29 5:51 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-27 6:13 [PATCH v4 00/12] mm/debug_vm_pgtable: Enhancements Gavin Shan
2021-07-27 6:13 ` [PATCH v4 01/12] mm/debug_vm_pgtable: Introduce struct pgtable_debug_args Gavin Shan
2021-07-28 7:32 ` Anshuman Khandual
2021-07-28 7:38 ` Gavin Shan
2021-07-29 4:45 ` Anshuman Khandual
2021-07-29 9:40 ` Gavin Shan
2021-07-27 6:13 ` [PATCH v4 02/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in basic tests Gavin Shan
2021-07-29 4:53 ` Anshuman Khandual
2021-07-27 6:13 ` [PATCH v4 03/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in leaf and savewrite tests Gavin Shan
2021-07-29 5:00 ` Anshuman Khandual
2021-07-27 6:13 ` [PATCH v4 04/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in protnone and devmap tests Gavin Shan
2021-07-29 5:02 ` Anshuman Khandual
2021-07-27 6:13 ` [PATCH v4 05/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in soft_dirty and swap tests Gavin Shan
2021-07-29 5:07 ` Anshuman Khandual
2021-07-27 6:13 ` [PATCH v4 06/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in migration and thp tests Gavin Shan
2021-07-28 11:08 ` Anshuman Khandual
2021-07-28 23:54 ` Gavin Shan
2021-07-27 6:13 ` [PATCH v4 07/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in PTE modifying tests Gavin Shan
2021-07-29 5:16 ` Anshuman Khandual
2021-07-27 6:13 ` [PATCH v4 08/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in PMD " Gavin Shan
2021-07-29 5:30 ` Anshuman Khandual
2021-07-27 6:13 ` [PATCH v4 09/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in PUD " Gavin Shan
2021-07-29 5:44 ` Anshuman Khandual
2021-07-27 6:13 ` [PATCH v4 10/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in PGD and P4D " Gavin Shan
2021-07-29 5:51 ` Anshuman Khandual [this message]
2021-07-27 6:14 ` [PATCH v4 11/12] mm/debug_vm_pgtable: Remove unused code Gavin Shan
2021-07-29 5:59 ` Anshuman Khandual
2021-07-27 6:14 ` [PATCH v4 12/12] mm/debug_vm_pgtable: Fix corrupted page flag Gavin Shan
2021-07-28 7:53 ` Christophe Leroy
2021-07-28 10:05 ` Anshuman Khandual
2021-07-29 0:00 ` Gavin Shan
2021-07-29 6:05 ` Anshuman Khandual
2021-07-29 7:14 ` [PATCH v4 00/12] mm/debug_vm_pgtable: Enhancements Anshuman Khandual
2021-08-02 0:09 ` Gavin Shan
2021-08-02 4:53 ` Anshuman Khandual
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d373368a-52c9-30b8-5300-edaacad077ef@arm.com \
--to=anshuman.khandual@arm.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=cai@lca.pw \
--cc=catalin.marinas@arm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=chuhu@redhat.com \
--cc=gerald.schaefer@linux.ibm.com \
--cc=gshan@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shan.gavin@gmail.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).