Re: [PATCH 2/3] mm: gup: allow FOLL_PIN to scale in SMP

From: Linus Torvalds
Date: Thu May 06 2021 - 22:34:31 EST


On Thu, May 6, 2021 at 4:25 PM Peter Xu <peterx@xxxxxxxxxx> wrote:
>
> + if (flags & FOLL_PIN && !atomic_read(&mm->has_pinned))

Please add parentheses to clarify code like this and make the grouping
much more visually obvious.

Yes, yes, '&' has higher precedence than '&&'. This is not about the
compiler, this is about the humans reading it. So please write it as

if ((flags & FOLL_PIN) && !atomic_read(&mm->has_pinned))

instead (this problem remains - and the fix is the same - in the 3/3 patch).

Otherwise the series looks fine to me (although admittedly I do find
the commit message to be ridiculously verbose for such a trivial patch
- at some point the actual _point_ if it all gets hidden in the long
commit message).

Linus