linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Peter Xu <peterx@redhat.com>
Cc: Linux MM Mailing List <linux-mm@kvack.org>,
	Jason Gunthorpe <jgg@nvidia.com>,
	 John Hubbard <jhubbard@nvidia.com>, Jan Kara <jack@suse.cz>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Andrea Arcangeli <aarcange@redhat.com>
Subject: Re: Possible race with page_maybe_dma_pinned?
Date: Wed, 29 Sep 2021 15:47:05 -0700	[thread overview]
Message-ID: <CAHk-=wjdiXyXFukBUwLKdSXRrwTzyRnynLFvJUe1BM4D6wBvsw@mail.gmail.com> (raw)
In-Reply-To: <YVTFEAwHEZfUrSCT@t490s>

On Wed, Sep 29, 2021 at 12:57 PM Peter Xu <peterx@redhat.com> wrote:
>
> Now we have 3 callers of page_maybe_dma_pinned():
>
>         1. page_needs_cow_for_dma
>         2. pte_is_pinned
>         3. shrink_page_list
>
> The 1st one is good as it takes the seqlock for write properly.  The 2nd & 3rd
> are missing, we may need to add them.

Well, the pte_is_pinned() case at least could do the seqlock in
clear_soft_dirty() - it has the vma and mm available.

The page shrinker has always been problematic since it doesn't have
the vm (and by "always" I mean "modern times" - long ago we used to
scan virtually, in the days before rmap)

One option might be for fast-gup to give up on locked pages. I think
the page lock is the only thing that shrink_page_list() serializes
with.

           Linus


  reply	other threads:[~2021-09-29 22:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29 19:57 Peter Xu
2021-09-29 22:47 ` Linus Torvalds [this message]
2021-09-30  1:57   ` John Hubbard
2021-09-30 11:11     ` Jan Kara

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='CAHk-=wjdiXyXFukBUwLKdSXRrwTzyRnynLFvJUe1BM4D6wBvsw@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=jgg@nvidia.com \
    --cc=jhubbard@nvidia.com \
    --cc=linux-mm@kvack.org \
    --cc=peterx@redhat.com \
    /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