2021-05-07 06:11:44

by Linus Torvalds

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

On Thu, May 6, 2021 at 4:25 PM Peter Xu <[email protected]> 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