Re: [PATCH v2 2/2] mm: prevent gup_fast from racing with COW during fork
From: Linus Torvalds
Date: Wed Nov 04 2020 - 13:46:54 EST
On Tue, Nov 3, 2020 at 7:17 PM Ahmed S. Darwish <a.darwish@xxxxxxxxxxxxx> wrote:
>
> Nonetheless, as you mentioned in the later (dropped) part of your
> message, I think do_ is better than __do_, so the final result will be:
>
> do___read_seqcount_retry()
> do_read_seqcount_retry()
> do_raw_write_seqcount_begin()
> do_raw_write_seqcount_end()
> do_write_seqcount_begin()
> ...
>
> and so on.
Looks reasonable to me.
And can you add a few comments to the magic type macros, so that it's
a lot more obvious what the end result was. I clearly wasn't able to
follow all the _Generic() cases from the seqcount_t to the final end
result. It's a really odd combination of subtle _GENERIC() macro and
token pasting to get from zeqcount_t to "false" in
__seqcount_lock_preemptible().
I can see it when I really look, but when looking at the actual use,
it's very non-obvious indeed.
Linus