Re: [PATCH] Don't touch single threaded PTEs which are on the right node

From: Mel Gorman
Date: Thu Oct 13 2016 - 14:17:24 EST


On Thu, Oct 13, 2016 at 11:04:02AM -0700, Andi Kleen wrote:
> > > do {
> > > oldpte = *pte;
> > > @@ -94,6 +100,13 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
> > > /* Avoid TLB flush if possible */
> > > if (pte_protnone(oldpte))
> > > continue;
> > > +
> > > + /*
> > > + * Don't mess with PTEs if page is already on the node
> > > + * a single-threaded process is running on.
> > > + */
> > > + if (target_node == page_to_nid(page))
> > > + continue;
> > > }
> > >
> >
> > Check target_node != NUMA_NODE && target_node == page_to_nid(page) to
> > avoid unnecessary page->flag masking and shifts?
>
> I didn't do this last change because I expect a potentially mispredicted
> check is more expensive than some shifting/masking.
>

Ok, that's fair enough. For something that minor I expect it to be a
case of "you win some you lose some" depending on workload, CPU and
phase of the moon.

Thanks.

--
Mel Gorman
SUSE Labs