[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+CK2bB_DwxGCD0TOJ7B1gN4sgXg5Bptw2LQbuD7Q4gQFm3vCg@mail.gmail.com>
Date: Wed, 26 Jan 2022 07:34:19 -0500
From: Pasha Tatashin <pasha.tatashin@...een.com>
To: David Rientjes <rientjes@...gle.com>
Cc: LKML <linux-kernel@...r.kernel.org>, linux-mm <linux-mm@...ck.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Paul Turner <pjt@...gle.com>, Wei Xu <weixugc@...gle.com>,
Greg Thelen <gthelen@...gle.com>,
Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
Mike Rapoport <rppt@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>,
Jiri Slaby <jirislaby@...nel.org>,
Muchun Song <songmuchun@...edance.com>,
Fusion Future <qydwhotmail@...il.com>,
Hugh Dickins <hughd@...gle.com>, Zi Yan <ziy@...dia.com>,
Anshuman Khandual <anshuman.khandual@....com>
Subject: Re: [PATCH v3 3/4] mm/khugepaged: unify collapse pmd clear, flush and free
On Wed, Jan 26, 2022 at 1:34 AM David Rientjes <rientjes@...gle.com> wrote:
>
> On Wed, 26 Jan 2022, Pasha Tatashin wrote:
>
> > Unify the code that flushes, clears pmd entry, and frees the PTE table
> > level into a new function collapse_and_free_pmd().
> >
> > This clean-up is useful as in the next patch we will add another call to
> > this function to iterate through PTE prior to freeing the level for page
> > table check.
> >
> > Signed-off-by: Pasha Tatashin <pasha.tatashin@...een.com>
>
> Acked-by: David Rientjes <rientjes@...gle.com>
Thank you, David.
>
> One nit below.
>
> > ---
> > mm/khugepaged.c | 32 ++++++++++++++++----------------
> > 1 file changed, 16 insertions(+), 16 deletions(-)
> >
> > diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> > index 35f14d0a00a6..440112355ffe 100644
> > --- a/mm/khugepaged.c
> > +++ b/mm/khugepaged.c
> > @@ -1416,6 +1416,17 @@ static int khugepaged_add_pte_mapped_thp(struct mm_struct *mm,
> > return 0;
> > }
> >
> > +static void collapse_and_free_pmd(struct mm_struct *mm, struct vm_area_struct *vma,
> > + unsigned long addr, pmd_t *pmdp)
> > +{
> > + spinlock_t *ptl = pmd_lock(vma->vm_mm, pmdp);
> > + pmd_t pmd = pmdp_collapse_flush(vma, addr, pmdp);
> > +
> > + spin_unlock(ptl);
>
> No strong objection, but I think the typical style would be to declare the
> local variables separately and avoid mixing the code, especially in cases
> when taking locks (and not just initializing the local variables).
I will address this in the next revision.
Thank you,
Pasha
Powered by blists - more mailing lists