linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: "Ahmed S. Darwish" <a.darwish@linutronix.de>
Cc: <linux-kernel@vger.kernel.org>, Peter Xu <peterx@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>,
	Christoph Hellwig <hch@lst.de>, Hugh Dickins <hughd@google.com>,
	Jan Kara <jack@suse.cz>, Jann Horn <jannh@google.com>,
	John Hubbard <jhubbard@nvidia.com>,
	Kirill Shutemov <kirill@shutemov.name>,
	Kirill Tkhai <ktkhai@virtuozzo.com>,
	Leon Romanovsky <leonro@nvidia.com>,
	Linux-MM <linux-mm@kvack.org>, Michal Hocko <mhocko@suse.com>,
	Oleg Nesterov <oleg@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	"Sebastian A. Siewior" <bigeasy@linutronix.de>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v3 2/2] mm: prevent gup_fast from racing with COW during fork
Date: Fri, 6 Nov 2020 13:57:46 -0400	[thread overview]
Message-ID: <20201106175746.GX2620339@nvidia.com> (raw)
In-Reply-To: <20201106171716.GA91138@lx-t490>

On Fri, Nov 06, 2020 at 06:17:16PM +0100, Ahmed S. Darwish wrote:
> Hi Jason,
> 
> On Fri, Nov 06, 2020 at 11:55:14AM -0400, Jason Gunthorpe wrote:
> ...
> > +	if (gup_flags & FOLL_PIN) {
> > +		seq = raw_read_seqcount(&current->mm->write_protect_seq);
> > +		if (seq & 1)
> > +			return 0;
> > +	}
> > +
> ...
> > +	if (gup_flags & FOLL_PIN) {
> > +		if (read_seqcount_t_retry(&current->mm->write_protect_seq,
> > +					  seq)) {
> > +			unpin_user_pages(pages, nr_pinned);
> > +			return 0;
> > +		}
> > +	}
> 
> From seqlock.h:
> 
>     /**
>      * raw_read_seqcount() - read the raw seqcount_t counter value
>      * ...
>      * Return: count to be passed to read_seqcount_retry()
>      */
>     #define raw_read_seqcount(s)
> 
> Please avoid using the internal API (read_seqcount_*t*_retry) and just
> use read_seqcount_retry() as the documentation suggests.

Oh, yes I didn't notice this one in all the discussion that spawned
from the first thread. Thanks

Jason


  reply	other threads:[~2020-11-06 17:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06 15:55 [PATCH v3 0/2] Add a seqcount between gup_fast and copy_page_range() Jason Gunthorpe
2020-11-06 15:55 ` [PATCH v3 1/2] mm: reorganize internal_get_user_pages_fast() Jason Gunthorpe
2020-11-06 15:55 ` [PATCH v3 2/2] mm: prevent gup_fast from racing with COW during fork Jason Gunthorpe
2020-11-06 17:17   ` Ahmed S. Darwish
2020-11-06 17:57     ` Jason Gunthorpe [this message]
2020-11-06 18:52 ` [PATCH v3 0/2] Add a seqcount between gup_fast and copy_page_range() Ahmed S. Darwish

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=20201106175746.GX2620339@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=a.darwish@linutronix.de \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=bigeasy@linutronix.de \
    --cc=hch@lst.de \
    --cc=hughd@google.com \
    --cc=jack@suse.cz \
    --cc=jannh@google.com \
    --cc=jhubbard@nvidia.com \
    --cc=kirill@shutemov.name \
    --cc=ktkhai@virtuozzo.com \
    --cc=leonro@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=oleg@redhat.com \
    --cc=peterx@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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).