Re: [PATCH 1/2] mm: avoid spurious 'bad pmd' warning messages
From: Ross Zwisler
Date: Wed May 17 2017 - 14:23:31 EST
On Wed, May 17, 2017 at 10:33:58AM -0700, Dave Hansen wrote:
> On 05/17/2017 10:16 AM, Ross Zwisler wrote:
> > @@ -3061,7 +3061,7 @@ static int pte_alloc_one_map(struct vm_fault *vmf)
> > * through an atomic read in C, which is what pmd_trans_unstable()
> > * provides.
> > */
> > - if (pmd_trans_unstable(vmf->pmd) || pmd_devmap(*vmf->pmd))
> > + if (pmd_devmap(*vmf->pmd) || pmd_trans_unstable(vmf->pmd))
> > return VM_FAULT_NOPAGE;
>
> I'm worried we are very unlikely to get this right in the future. It's
> totally not obvious what the ordering requirement is here.
>
> Could we move pmd_devmap() and pmd_trans_unstable() into a helper that
> gets the ordering right and also spells out the ordering requirement?
Sure, I'll fix this for v2.
Thanks for the review.