linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: John Hubbard <jhubbard@nvidia.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, Alistair Popple <apopple@nvidia.com>
Subject: Re: [PATCH] mm/gup: Remove the restriction on locked with FOLL_LONGTERM
Date: Fri, 18 Nov 2022 16:00:33 -0400	[thread overview]
Message-ID: <Y3fkYaW7Y8ZVDk8Y@nvidia.com> (raw)
In-Reply-To: <5c5f2c34-05d7-7e64-e368-0f240ef15eeb@nvidia.com>

On Wed, Nov 16, 2022 at 02:11:04PM -0800, John Hubbard wrote:
> On 11/16/22 12:07, Jason Gunthorpe wrote:
> > This restriction was created because FOLL_LONGTERM used to scan the vma
> > list, so it could not tolerate becoming unlocked. That was fixed in commit
> > 52650c8b466b ("mm/gup: remove the vma allocation from
> > gup_longterm_locked()") and the restriction on !vma was removed.
> > 
> > However, the locked restriction remained, even though it isn't necessary
> > anymore.
> > 
> > Adjust __gup_longterm_locked() so it can handle the mmap_read_lock()
> > becoming unlocked while it is looping for migration. Migration does not
> > require the mmap_read_sem because it is only handling struct pages.  If we
> > had to unlock then ensure the whole thing returns unlocked.
> > 
> > Remove __get_user_pages_remote() and __gup_longterm_unlocked(). These
> > cases can now just directly call other functions.
> > 
> > Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> > ---
> >   mm/gup.c | 109 ++++++++++++++-----------------------------------------
> >   1 file changed, 27 insertions(+), 82 deletions(-)
> 
> Looks nice.
> 
> Even after this cleanup, gup.c is still a bit of a ball of string, what
> with things like __gup_longterm_locked() actually handling
> !FOLL_LONGTERM, and a bunch of other vestigial stuff, but this takes us
> in the right direction.

What do you think of this:

https://github.com/jgunthorpe/linux/commits/gup

Jason


  reply	other threads:[~2022-11-18 20:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 20:07 Jason Gunthorpe
2022-11-16 22:11 ` John Hubbard
2022-11-18 20:00   ` Jason Gunthorpe [this message]
2022-11-19  2:55     ` John Hubbard

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=Y3fkYaW7Y8ZVDk8Y@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=jhubbard@nvidia.com \
    --cc=linux-mm@kvack.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