[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181221033159.GF23877@ziepe.ca>
Date: Thu, 20 Dec 2018 20:31:59 -0700
From: Jason Gunthorpe <jgg@...pe.ca>
To: Joe Perches <joe@...ches.com>
Cc: 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>
Subject: Re: rfc: bool structure members (was Re: [PATCH V3] net/mlx4: Get
rid of page operation after dma_alloc_coherent)
On Thu, Dec 20, 2018 at 06:25:05PM -0800, Joe Perches wrote:
> I agree it's not a very good message nor is bool use
> of structure members a real problem except in very
> few cases.
I think the issue is that the link it shows lacks the context of the
discussion thread - and the actual guidance here is more
complicated.
A discussion in coding style would probably be better.
- Don't put multiple true/false fields in a single struct (be it bool,
u8, int, etc) - use bit-fields instead.
- Don't use bool if cache line layout matters, its size and alignment
varies
- Do use bool to clearly express that the variable, parameter or
structure member can only take on a true/false value.
.. and I also seem to remember there is a small performance downside
to bool stores in some ABIs as the compiler has to cannonize stores to
0 or 1? But this also eliminates certain bug classes..
Jason
Powered by blists - more mailing lists