Re: [PATCH 2/2] mm: prevent gup_fast from racing with COW during fork

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 26, 2020 at 4:50 PM Jason Gunthorpe <jgg@xxxxxxxxxx> 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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux