linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pasha Tatashin <pasha.tatashin@soleen.com>
To: David Rientjes <rientjes@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Paul Turner <pjt@google.com>, Wei Xu <weixugc@google.com>,
	 Greg Thelen <gthelen@google.com>, Ingo Molnar <mingo@redhat.com>,
	Will Deacon <will@kernel.org>,  Mike Rapoport <rppt@kernel.org>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	 "H. Peter Anvin" <hpa@zytor.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
	 Jiri Slaby <jirislaby@kernel.org>,
	Muchun Song <songmuchun@bytedance.com>,
	 Fusion Future <qydwhotmail@gmail.com>,
	Hugh Dickins <hughd@google.com>, Zi Yan <ziy@nvidia.com>,
	 Anshuman Khandual <anshuman.khandual@arm.com>
Subject: Re: [PATCH v3 3/4] mm/khugepaged: unify collapse pmd clear, flush and free
Date: Wed, 26 Jan 2022 07:34:19 -0500	[thread overview]
Message-ID: <CA+CK2bB_DwxGCD0TOJ7B1gN4sgXg5Bptw2LQbuD7Q4gQFm3vCg@mail.gmail.com> (raw)
In-Reply-To: <edd2d5d0-998a-633c-fc60-4f31ae768d3e@google.com>

On Wed, Jan 26, 2022 at 1:34 AM David Rientjes <rientjes@google.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@soleen.com>
>
> Acked-by: David Rientjes <rientjes@google.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


  reply	other threads:[~2022-01-26 12:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26  6:05 [PATCH v3 0/4] page table check fixes and cleanups Pasha Tatashin
2022-01-26  6:05 ` [PATCH v3 1/4] mm/debug_vm_pgtable: remove pte entry from the page table Pasha Tatashin
2022-01-26  6:26   ` David Rientjes
2022-01-26  6:05 ` [PATCH v3 2/4] mm/page_table_check: use unsigned long for page counters and cleanup Pasha Tatashin
2022-01-26  6:29   ` David Rientjes
2022-01-26  6:05 ` [PATCH v3 3/4] mm/khugepaged: unify collapse pmd clear, flush and free Pasha Tatashin
2022-01-26  6:34   ` David Rientjes
2022-01-26 12:34     ` Pasha Tatashin [this message]
2022-01-26  6:05 ` [PATCH v3 4/4] mm/page_table_check: check entries at pmd levels Pasha Tatashin
2022-01-26  6:45   ` David Rientjes
2022-01-26 12:46     ` Pasha Tatashin

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=CA+CK2bB_DwxGCD0TOJ7B1gN4sgXg5Bptw2LQbuD7Q4gQFm3vCg@mail.gmail.com \
    --to=pasha.tatashin@soleen.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=gthelen@google.com \
    --cc=hpa@zytor.com \
    --cc=hughd@google.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@redhat.com \
    --cc=pjt@google.com \
    --cc=qydwhotmail@gmail.com \
    --cc=rientjes@google.com \
    --cc=rppt@kernel.org \
    --cc=songmuchun@bytedance.com \
    --cc=weixugc@google.com \
    --cc=will@kernel.org \
    --cc=ziy@nvidia.com \
    /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