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

From: Linus Torvalds
Date: Tue Nov 03 2020 - 12:40:47 EST


On Mon, Nov 2, 2020 at 10:52 PM Ahmed S. Darwish
<a.darwish@xxxxxxxxxxxxx> wrote:
>
> The problem is, I've already documented seqlock.h to death.... There are
> more comments than code in there, and there is "seqlock.rst" under
> Documentation/ to further describe the big picture.

Well, honestly, I think the correct thing to do is to get rid of the
*_seqcount_t_*() functions entirely.

They add nothing but confusion, and they are entirely misnamed. That's
not the pattern we use for "internal use only" functions, and they are
*very* confusing.

They have other issues too: like raw_write_seqcount_end() not being
usable on its own when preemptibility isn't an issue like here. You
basically _have_ to use raw_write_seqcount_t_end(), because otherwise
it tries to re-enable preemption that was never there.

Linus