linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: x86@kernel.org, willy@infradead.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, aarcange@redhat.com,
	kirill.shutemov@linux.intel.com, jroedel@suse.de
Subject: Re: [RFC][PATCH 5/9] mm: Rename pmd_read_atomic()
Date: Tue, 1 Dec 2020 09:57:22 +0100	[thread overview]
Message-ID: <20201201085722.GR2414@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20201130153120.GZ5487@ziepe.ca>

On Mon, Nov 30, 2020 at 11:31:20AM -0400, Jason Gunthorpe wrote:
> On Mon, Nov 30, 2020 at 12:27:10PM +0100, Peter Zijlstra wrote:
> > There's no point in having the identical routines for PTE/PMD have
> > different names.
> > 
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> >  include/linux/pgtable.h    |    7 +------
> >  mm/hmm.c                   |    2 +-
> >  mm/mapping_dirty_helpers.c |    2 +-
> >  mm/mprotect.c              |    2 +-
> >  mm/userfaultfd.c           |    2 +-
> >  5 files changed, 5 insertions(+), 10 deletions(-)
> > 
> > +++ b/include/linux/pgtable.h
> > @@ -1244,11 +1244,6 @@ static inline int pud_trans_unstable(pud
> >  #endif
> >  }
> >  
> > -static inline pmd_t pmd_read_atomic(pmd_t *pmdp)
> > -{
> > -	return pmdp_get_lockless(pmdp);
> > -}
> > -
> >  #ifndef arch_needs_pgtable_deposit
> >  #define arch_needs_pgtable_deposit() (false)
> >  #endif
> > @@ -1275,7 +1270,7 @@ static inline pmd_t pmd_read_atomic(pmd_
> >   */
> >  static inline int pmd_none_or_trans_huge_or_clear_bad(pmd_t *pmd)
> >  {
> > -	pmd_t pmdval = pmd_read_atomic(pmd);
> > +	pmd_t pmdval = pmdp_get_lockless(pmd);
> >  	/*
> >  	 * The barrier will stabilize the pmdval in a register or on
> >  	 * the stack so that it will stop changing under the code.
> > +++ b/mm/hmm.c
> > @@ -356,7 +356,7 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp,
> >  		 * huge or device mapping one and compute corresponding pfn
> >  		 * values.
> >  		 */
> > -		pmd = pmd_read_atomic(pmdp);
> > +		pmd = pmdp_get_lockless(pmdp);
> >  		barrier();
> >  		if (!pmd_devmap(pmd) && !pmd_trans_huge(pmd))
> >  			goto again;
> 
> The pagewalk API doesn't call the functions with interrupts disabled,
> doesn't this mean we hit this assertion?
> 
> +#if CONFIG_PGTABLE_LEVELS > 2
> +static inline pmd_t pmdp_get_lockless(pmd_t *pmdp)
> +{
> +       pmd_t pmd;
> +
> +       lockdep_assert_irqs_disabled();
> +
> 
> It is only holding the read side of the mmap_sem here

Hurmph, good point. I'll see what I can do about that.


  reply	other threads:[~2020-12-01  8:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30 11:27 [RFC][PATCH 0/9] Clean up i386-PAE Peter Zijlstra
2020-11-30 11:27 ` [RFC][PATCH 1/9] mm: Update ptep_get_lockless()s comment Peter Zijlstra
2020-11-30 11:27 ` [RFC][PATCH 2/9] x86/mm/pae: Make pmd_t similar to pte_t Peter Zijlstra
2020-11-30 11:27 ` [RFC][PATCH 3/9] sh/mm: " Peter Zijlstra
2020-11-30 14:10   ` David Laight
2020-11-30 14:21     ` Peter Zijlstra
2020-11-30 11:27 ` [RFC][PATCH 4/9] mm: Fix pmd_read_atomic() Peter Zijlstra
2020-11-30 11:27 ` [RFC][PATCH 5/9] mm: Rename pmd_read_atomic() Peter Zijlstra
2020-11-30 15:31   ` Jason Gunthorpe
2020-12-01  8:57     ` Peter Zijlstra [this message]
2020-11-30 11:27 ` [RFC][PATCH 6/9] mm/gup: Fix the lockless walkers Peter Zijlstra
2020-11-30 11:27 ` [RFC][PATCH 7/9] x86/mm/pae: Dont (ab)use atomic64 Peter Zijlstra
2020-11-30 11:27 ` [RFC][PATCH 8/9] x86/mm/pae: Use WRITE_ONCE() Peter Zijlstra
2020-11-30 11:27 ` [RFC][PATCH 9/9] x86/mm/pae: Be consistent with pXXp_get_and_clear() Peter Zijlstra

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=20201201085722.GR2414@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=aarcange@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=jroedel@suse.de \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    --cc=x86@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).