Re: [RFC][PATCH] A generic boolean

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alan Cox wrote:
Ar Gwe, 2006-08-04 am 17:58 +0200, ysgrifennodd Jes Sorensen:
You don't use bool for talking to hardware, you use it for the most
efficient compiler behaviour when working with true/false values.
Thats the problem, people will start putting them into structs, and
voila all alignment predictability has gone out the window.

Jes, try reading as well as writing. Given you even quoted "You don't
use bool for talking to hardware" maybe you should read it.

Alan,

I did read, I never suggested putting it into structs describing
hardware registers.

Structure alignment is generally a bad idea anyway because even array
and word alignment are pretty variable between processors.

It's fairly common in drivers to layout things in effective ways in
structs relying on alignment. It can make a noticeable difference if
you get cacheline alignment wrong. For example in network drivers where
parts of the struct is used for receive and the other part is used for
transmit and the two parts can run in parallel on different CPUs.
Obviously one ends up using the aligned attribute, but the more one can
avoid adding those on in the struct the easier it is to maintain and
read.

Regards,
Jes

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux