Re: [PATCH] mm/slub.c: use 'unsigned long' instead of 'int' for variable 'slub_debug'

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

 



On 07/15/2013 10:17 PM, Christoph Lameter wrote:
> On Mon, 15 Jul 2013, Chen Gang wrote:
> 
>> > On 07/12/2013 09:53 PM, Christoph Lameter wrote:
>>> > > On Fri, 12 Jul 2013, Chen Gang wrote:
>>> > >
>>>> > >> Since all values which can be assigned to 'slub_debug' are 'unsigned
>>>> > >> long', recommend also to define 'slub_debug' as 'unsigned long' to
>>>> > >> match the type precisely
>>> > >
>>> > > The bit definitions in slab.h as well as slub.c all assume that these are
>>> > > 32 bit entities. See f.e. the defition of the internal slub flags:
>>> > >
>>> > > /* Internal SLUB flags */
>>> > > #define __OBJECT_POISON         0x80000000UL /* Poison object */
>>> > > #define __CMPXCHG_DOUBLE        0x40000000UL /* Use cmpxchg_double */
>>> > >
>> >
>> > As far as I know, 'UL' means "unsigned long", is it correct ?
> This is the way hex constants are generally specified.
> 
> 

The C compiler will treat 'UL' as "unsigned long".

If we really use 32-bit as unsigned number, better to use 'U' instead of
'UL' (e.g. 0x80000000U instead of 0x80000000UL).

Since it is unsigned 32-bit number, it is better to use 'unsigned int'
instead of 'int', which can avoid related warnings if "EXTRA_CFLAGS=-W".


Thanks.
-- 
Chen Gang

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]