Re: [PATCH 01/31] mm: use pmdp_get_lockless() without surplus barrier()

From: Hugh Dickins
Date: Thu Jun 01 2023 - 22:31:20 EST


On Fri, 26 May 2023, Peter Xu wrote:
>
> The other confusing thing on this _lockless trick on PAE is, I think it
> _might_ go wrong with devmap..
>
> The problem is here we assumed even if high & low may not match, we still
> can rely on most pte/pmd checks are done only on low bits (except _none()
> check) to guarantee at least the checks are still atomic on low bits.
>
> But it seems to me it's not true anymore if with pmd_trans_huge() after
> devmap introduced, e.g.:

I agree that there would likely be a problem for p??_devmap() on 32-bit
PAE: but (I hope I followed the chain correctly!) I had earlier found
that pmd_devmap() can only return true when CONFIG_ZONE_DEVICE=y, and
config ZONE_DEVICE depends on ARCH_HAS_PTE_DEVMAP, and ARCH_HAS_PTE_DEVMAP
is only selected (in some cases) by arm64, powerpc if PPC_BOOK3S_64, and
x86 if X86_64.

So I stopped worrying about devmap.

Hugh