[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1037b514-30e7-c128-38c1-9c98488be337@nvidia.com>
Date: Thu, 30 Jan 2020 19:19:30 -0800
From: John Hubbard <jhubbard@...dia.com>
To: "Kirill A. Shutemov" <kirill@...temov.name>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Al Viro <viro@...iv.linux.org.uk>,
Christoph Hellwig <hch@...radead.org>,
Dan Williams <dan.j.williams@...el.com>,
Dave Chinner <david@...morbit.com>,
Ira Weiny <ira.weiny@...el.com>, Jan Kara <jack@...e.cz>,
Jason Gunthorpe <jgg@...pe.ca>,
Jonathan Corbet <corbet@....net>,
Jérôme Glisse <jglisse@...hat.com>,
Michal Hocko <mhocko@...e.com>,
Mike Kravetz <mike.kravetz@...cle.com>,
Shuah Khan <shuah@...nel.org>,
Vlastimil Babka <vbabka@...e.cz>, <linux-doc@...r.kernel.org>,
<linux-fsdevel@...r.kernel.org>, <linux-kselftest@...r.kernel.org>,
<linux-rdma@...r.kernel.org>, <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>
Subject: Re: [PATCH v2 4/8] mm/gup: track FOLL_PIN pages
On 1/30/20 3:31 AM, Kirill A. Shutemov wrote:
...
>>>> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
>>>> index 0a55dec68925..b1079aaa6f24 100644
>>>> --- a/mm/huge_memory.c
>>>> +++ b/mm/huge_memory.c
>>>> @@ -958,6 +958,11 @@ struct page *follow_devmap_pmd(struct vm_area_struct *vma, unsigned long addr,
>>>> */
>>>> WARN_ONCE(flags & FOLL_COW, "mm: In follow_devmap_pmd with FOLL_COW set");
>>>> + /* FOLL_GET and FOLL_PIN are mutually exclusive. */
>>>> + if (WARN_ON_ONCE((flags & (FOLL_PIN | FOLL_GET)) ==
>>>> + (FOLL_PIN | FOLL_GET)))
>>>
>>> Too many parentheses.
>>
>>
>> OK, I'll remove at least one. :)
>
> I see two.
ah, correction: actually, the original statement has exactly the right number of parentheses.
The relevant C precedence order is:
==
&
|
...which means that both "&" and "|" operations need parentheses protection from the higher
precedence "==" operation.
(There are other places in the kernel that have this exact pattern, too, with the same
pattern of parentheses that I'm using, of course.)
thanks,
--
John Hubbard
NVIDIA
Powered by blists - more mailing lists