public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* The type of bitops
@ 2013-05-06 23:53 H. Peter Anvin
  2013-05-06 23:53 ` H. Peter Anvin
  2013-05-07  0:51 ` Linus Torvalds
  0 siblings, 2 replies; 12+ messages in thread
From: H. Peter Anvin @ 2013-05-06 23:53 UTC (permalink / raw)
  To: linux-arch, Linux Kernel Mailing List, Linus Torvalds,
	Ingo Molnar, Thomas Gleixner

The type of bitops is currently "int" on most, if not all, architectures
except sparc64 where it is "unsigned long".  This already has the
potential of causing failures on extremely large non-NUMA x86 boxes
(specifically if any one node contains more than 8 TiB of memory, e.g.
in an interleaved memory system.)

x86 has hardware bitmask instructions which are signed, this limits the
types to either "int" or "long".

It seems pretty clear to me at least that x86-64 really should use
"long".  However, before blindly making that change I wanted to feel
people out for what this should look like across architectures.

Moving this forward, I see a couple of possibilities:

1. We simply change the type to "long" on x86, and let this be a fully
   architecture-specific option.  This is easy, obviously.

2. Same as above, except we also define a typedef for whatever type is
   the bitops argument type (bitops_t?  bitpos_t?)

3. Change the type to "long" Linux-wide, on the logic that it should be
   the same as the general machine width across all platforms.

4. Do some macro hacks so the bitops are dependent on the size of the
   argument.

5. Introduce _long versions of the bitops.

6. Do nothing at all.


Are there any 64-bit architectures where a 64-bit argument would be very
costly?

	-hpa

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-05-07 23:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-06 23:53 The type of bitops H. Peter Anvin
2013-05-06 23:53 ` H. Peter Anvin
2013-05-07  0:51 ` Linus Torvalds
2013-05-07  1:36   ` H. Peter Anvin
2013-05-07  2:33     ` Linus Torvalds
2013-05-07  2:33       ` Linus Torvalds
2013-05-07 23:17   ` Andy Lutomirski
2013-05-07 23:17     ` Andy Lutomirski
2013-05-07 23:18     ` H. Peter Anvin
2013-05-07 23:18       ` H. Peter Anvin
2013-05-07 23:36       ` Andy Lutomirski
2013-05-07 23:36         ` Andy Lutomirski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox