linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>, Jan Kara <jack@suse.cz>,
	Josef Bacik <josef@toxicpanda.com>,
	Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [PATCH v2] mm: fix long time stall from mm_populate
Date: Tue, 3 Mar 2020 13:18:19 -0800	[thread overview]
Message-ID: <20200303211819.GB219683@google.com> (raw)
In-Reply-To: <20200303012203.GR29971@bombadil.infradead.org>

On Mon, Mar 02, 2020 at 05:22:03PM -0800, Matthew Wilcox wrote:
> On Mon, Mar 02, 2020 at 04:26:38PM -0800, Minchan Kim wrote:
> > @@ -1196,6 +1196,7 @@ int __mm_populate(unsigned long start, unsigned long len, int ignore_errors)
> >  	struct vm_area_struct *vma = NULL;
> >  	int locked = 0;
> >  	long ret = 0;
> > +	bool tried = false;
> 
> How about ...
> 
> 	int *lockedp = &locked;
> 
> >  
> >  	end = start + len;
> >  
> > @@ -1226,14 +1227,18 @@ int __mm_populate(unsigned long start, unsigned long len, int ignore_errors)
> >  		 * double checks the vma flags, so that it won't mlock pages
> >  		 * if the vma was already munlocked.
> >  		 */
> > -		ret = populate_vma_page_range(vma, nstart, nend, &locked);
> > +		ret = populate_vma_page_range(vma, nstart, nend,
> > +						tried ? NULL : &locked);
> 
> 		ret = populate_vma_page_range(vma, nstart, nend, lockedp);
> 
> >  		if (ret < 0) {
> >  			if (ignore_errors) {
> >  				ret = 0;
> >  				continue;	/* continue at next VMA */
> >  			}
> >  			break;
> > -		}
> > +		} else if (ret == 0)
> > +			tried = true;
> > +		else
> > +			tried = false;
> 
> 		} else if (ret == 0)
> 			lockedp = NULL;
> 
> Maybe there's a better name than lockedp.

Thanks for the review, Matthew.

It changes the behavior from mine in that it never set lockedp as "non-NULL"
since it had retried so that we lose fault retrying optimization for
successive addresses

I understand the code is not pretty there so that hard to follow it but
I am not sure the your suggestion makes it better.


  reply	other threads:[~2020-03-03 21:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-03  0:26 [PATCH v2] mm: fix long time stall from mm_populate Minchan Kim
2020-03-03  1:22 ` Matthew Wilcox
2020-03-03 21:18   ` Minchan Kim [this message]
2020-03-13 21:14 ` Minchan Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200303211819.GB219683@google.com \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=jack@suse.cz \
    --cc=josef@toxicpanda.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).