[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <71005ff2-e6b0-ca97-0d4b-6e6f7b491760@amazon.com>
Date: Tue, 25 Dec 2018 10:41:16 +0200
From: Gal Pressman <galpress@...zon.com>
To: Jason Gunthorpe <jgg@...pe.ca>
CC: Joe Perches <joe@...ches.com>,
Bart Van Assche <bvanassche@....org>,
Stephen Warren <swarren@...dotorg.org>,
Tariq Toukan <tariqt@...lanox.com>, <xavier.huwei@...wei.com>,
<netdev@...r.kernel.org>, <linux-rdma@...r.kernel.org>,
Doug Ledford <dledford@...hat.com>,
"Stephen Warren" <swarren@...dia.com>,
Christoph Hellwig <hch@....de>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Jonathan Corbet <corbet@....net>,
<linux-kernel@...r.kernel.org>
Subject: Re: rfc: bool structure members (was Re: [PATCH V3] net/mlx4: Get rid
of page operation after dma_alloc_coherent)
On 25-Dec-18 01:12, Jason Gunthorpe wrote:
> On Sun, Dec 23, 2018 at 06:42:20PM +0200, Gal Pressman wrote:
>> On 22-Dec-18 01:52, Jason Gunthorpe wrote:
>>> On Thu, Dec 20, 2018 at 09:12:43PM -0800, Joe Perches wrote:
>>>> Care to submit a coding_style.rst patch or
>>>> improve the one below this?
>>>
>>> I took yours and revised it a little bit. I spent some time looking at
>>> assembly and decided to drop the performance note, the number of cases
>>> that run into overhead seems pretty small and probably already
>>> requires !! to be correct. There is also an equally unlikely gain, ie
>>> 'if (a & b)' optimizes a tiny bit better for bool types.
>>>
>>> I also added a small intro on bool, as I know some people are
>>> unfamiliar with C11 _Bool and might think bool is just '#define bool
>>> u8'
>>>
>>> (for those added to the cc) I'm looking at cases, like the patch that
>>> spawned this, where the struct has a single bool and no performance
>>> considerations. As CH said, seeing that get converted to int due to
>>> checkpatch is worse than having used bool. Using u8 won't make this
>>> struct smaller or faster.
>>>
>>
>> Since a "Using bool" section is added, perhaps it's worth documenting the bool
>> usage as a function parameter [1]?
>>
>> [1] https://www.spinics.net/lists/linux-rdma/msg72336.html
>
> I'm not really sure how to express that as something concrete.. That
> specific case clearly called out for a flags as it was a widely used
> API - maybe less spread out cases like static functions or something
> are OK??
>
> Jason
>
Sounds reasonable, sometimes adding flags and enum for a single bool function
parameter is a bit too much IMO. For a widely used API it makes sense.
Powered by blists - more mailing lists