Re: [PATCH 03/12] mempolicy: fix migrate_pages(2) syscall return nr_failed

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

 



On Wed, 27 Sep 2023, Huang, Ying wrote:
> Hugh Dickins <hughd@xxxxxxxxxx> writes:
> > -static int queue_folios_pmd(pmd_t *pmd, spinlock_t *ptl, unsigned long addr,
> > +static void queue_folios_pmd(pmd_t *pmd, spinlock_t *ptl, unsigned long addr,
> 
> I don't find that "ptl" is used in the function now.  So, remove it?

Yes indeed, thanks for spotting that, I shall remove it.
And I think addr, end are also unused: I'll remove them too.

...
> > +		if (!(flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) ||
> > +		    !vma_migratable(vma)) {
> > +			qp->nr_failed++;
> > +			if (strictly_unmovable(flags))
> >  				break;
> > -			}
> > -
> > +		}
> 
> IIUC, even if !(flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) or
> !vma_migratable(vma), the folio will be isolated in migrate_folio_add()
> below.  Is this the expected behavior?

Yikes, I think you're right, thanks a lot: it was okay up until I realized
the "qp->large" issue, and had to separate out the migrate_folio_add()
failure case.  Late changes...

> 
> > +		if (migrate_folio_add(folio, qp->pagelist, flags)) {
...
> > @@ -731,22 +714,22 @@ static const struct mm_walk_ops queue_pages_lock_vma_walk_ops = {
> >  /*
> >   * Walk through page tables and collect pages to be migrated.
> >   *
> > - * If pages found in a given range are on a set of nodes (determined by
> > - * @nodes and @flags,) it's isolated and queued to the pagelist which is
> > - * passed via @private.
> > + * If pages found in a given range are not on the required set of @nodes,
> > + * and migration is allowed, they are isolated and queued to the pagelist
> > + * which is passed via @private.
> 
> s/@private/@pagelist/

Right: or even better, simply "queued to @pagelist."

...
> > @@ -1201,8 +1187,7 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from,
> >  	lru_cache_enable();
> >  	if (err < 0)
> >  		return err;
> > -	return busy;
> > -
> > +	return (nr_failed < INT_MAX) ? nr_failed : INT_MAX;
> 
>         return min_t(long, nr_failed, INT_MAX);
> ?

I may be the odd man out, but I read it more easily how it is:
so will stick with that, unless others object.

Very helpful comments: thank you,

Hugh




[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