lkml.org 
[lkml]   [2020]   [Oct]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/2] mm: prevent gup_fast from racing with COW during fork
On Mon, Oct 26, 2020 at 4:50 PM Jason Gunthorpe <jgg@nvidia.com> wrote:
>
> Right, it isn't a "seqcount" because the read side doesn't spin.

Not all readers spin for seqcount either.

Sure, it's the *common* case, but look at name resolution - it will
basically fail on a seqcount failure in RCU mode, and go to the "slow
and safe" version:

if (unlikely(read_seqcount_retry(&d->d_seq, nd->seq)))
return -ECHILD;

Exactly like gup_fast vs fork, in fact.

So no, you don't need to retry for seqcount failures, doing

seq = seqcount_begin(..);
... optimistic fast case ...
if (!read_seqcount_retry(.., seq))
return 0; // success
.. do slow case ...

is valid and happens.

Linus

\
 
 \ /
  Last update: 2020-10-27 01:20    [W:0.031 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site