Re: [PATCH v1 2/3] mm/gup: use gup_can_follow_protnone() also in GUP-fast

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 31, 2022 at 06:31:23PM +0200, David Hildenbrand wrote:
> >> +	/* Clear/invalidate the PTE before checking for PINs. */
> >> +	if (IS_ENABLED(CONFIG_HAVE_FAST_GUP))
> >> +		smp_mb();
> > 
> > Wondering whether this could be smp_mb__before_atomic().
> 
> We'll read via atomic_read().
> 
> That's a non-RMW operation. smp_mb__before_atomic() only applies to
> RMW (Read Modify Write) operations.

Ah right.

> >> diff --git a/mm/ksm.c b/mm/ksm.c
> >> index d7526c705081..971cf923c0eb 100644
> >> --- a/mm/ksm.c
> >> +++ b/mm/ksm.c
> >> @@ -1091,6 +1091,7 @@ static int write_protect_page(struct vm_area_struct *vma, struct page *page,
> >>  			goto out_unlock;
> >>  		}
> >>  
> >> +		/* See page_try_share_anon_rmap(): clear PTE first. */
> >>  		if (anon_exclusive && page_try_share_anon_rmap(page)) {
> >>  			set_pte_at(mm, pvmw.address, pvmw.pte, entry);
> >>  			goto out_unlock;
> >> diff --git a/mm/migrate_device.c b/mm/migrate_device.c
> >> index 27fb37d65476..47e955212f15 100644
> >> --- a/mm/migrate_device.c
> >> +++ b/mm/migrate_device.c
> >> @@ -193,20 +193,16 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp,
> >>  			bool anon_exclusive;
> >>  			pte_t swp_pte;
> >>  
> > 
> > flush_cache_page() missing here?
> 
> Hmm, wouldn't that already be missing on the !anon path right now?

Yes, I think Alistair plans to fix it too in the other patchset.  So either
this will rebase to that or it should fix it too.  Thanks,

-- 
Peter Xu





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux