[Ksummit-discuss] [CORE TOPIC] More useful types in the linux kernel
David Howells
dhowells at redhat.com
Fri Jul 22 07:03:06 UTC 2016
Dmitry Torokhov <dmitry.torokhov at gmail.com> wrote:
> > (1) A 'bits' and maybe a 'bits64' type. Currently you have to use unsigned
> > long when you want to deploy a flags field with which you're going to use
> > test_bit() and co. - but this typically wastes 32 bits on a 64-bit arch
> > because you can't use bits 32-63 as they might not exist.
>
> What is wrong with using DECLARE_BITMAP()? It will allocate exactly as
> many unsigned longs
You missed my point. *unsigned long* is the issue. The majority of the time
that wastes 32 bits on a 64-bit machine - especially when we don't need that
many flags. On some 64-bit arches we could use unsigned int instead.
David
More information about the Ksummit-discuss
mailing list