linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Josef Bacik <josef@toxicpanda.com>,
	kernel-team@fb.com, hannes@cmpxchg.org,
	linux-kernel@vger.kernel.org, tj@kernel.org, david@fromorbit.com,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	riel@redhat.com, jack@suse.cz
Subject: Re: [PATCH][v6] filemap: drop the mmap_sem for all blocking operations
Date: Thu, 13 Dec 2018 17:01:18 +0100	[thread overview]
Message-ID: <20181213160118.GA27517@quack2.suse.cz> (raw)
In-Reply-To: <20181212155536.5fb770a0c9b4f2399d4794e4@linux-foundation.org>

On Wed 12-12-18 15:55:36, Andrew Morton wrote:
> On Wed, 12 Dec 2018 10:27:57 -0500 Josef Bacik <josef@toxicpanda.com> wrote:
> 
> > v5->v6:
> > - added more comments as per Andrew's suggestion.
> > - fixed the fpin leaks in the two error paths that were pointed out.
> > 
> 
> hm,
> 
> > --- a/mm/filemap.c~filemap-drop-the-mmap_sem-for-all-blocking-operations-v6
> > +++ a/mm/filemap.c
> > @@ -2461,7 +2476,8 @@ static struct file *do_sync_mmap_readahe
> >  
> >  /*
> >   * Asynchronous readahead happens when we find the page and PG_readahead,
> > - * so we want to possibly extend the readahead further..
> > + * so we want to possibly extend the readahead further.  We return the file that
> > + * was pinned if we have to drop the mmap_sem in order to do IO.
> >   */
> >  static struct file *do_async_mmap_readahead(struct vm_fault *vmf,
> >  					    struct page *page)
> > @@ -2545,14 +2561,15 @@ retry_find:
> >  		page = pagecache_get_page(mapping, offset,
> >  					  FGP_CREAT|FGP_FOR_MMAP,
> >  					  vmf->gfp_mask);
> > -		if (!page)
> > +		if (!page) {
> > +			if (fpin)
> > +				goto out_retry;
> 
> Is this right?  If pagecache_get_page() returns NULL we can now return
> VM_FAULT_MAJOR|VM_FAULT_RETRY whereas we used to return ENOMEM.

Yes, but once we've dropped mmap_sem, there's no way safely return -ENOMEM.
So VM_FAULT_RETRY is really the only option to tell the caller that
mmap_sem is not held anymore...

So the patch looks good to me now. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>


								Honza

-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

      reply	other threads:[~2018-12-13 16:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11 17:37 [PATCH 0/3][V5] drop the mmap_sem when doing IO in the fault path Josef Bacik
2018-12-11 17:37 ` [PATCH 1/3] filemap: kill page_cache_read usage in filemap_fault Josef Bacik
2018-12-11 17:38 ` [PATCH 2/3] filemap: pass vm_fault to the mmap ra helpers Josef Bacik
2018-12-12 10:10   ` Jan Kara
2018-12-11 17:38 ` [PATCH 3/3] filemap: drop the mmap_sem for all blocking operations Josef Bacik
2018-12-11 21:15   ` Andrew Morton
2018-12-12 10:36     ` Jan Kara
2018-12-12 15:27   ` [PATCH][v6] " Josef Bacik
2018-12-12 23:55     ` Andrew Morton
2018-12-13 16:01       ` Jan Kara [this message]

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=20181213160118.GA27517@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=david@fromorbit.com \
    --cc=hannes@cmpxchg.org \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@redhat.com \
    --cc=tj@kernel.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