Re: C13 [13/14] Shrink __kmem_cache_create() parameter lists

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

 



On 09/03/2012 07:33 PM, Glauber Costa wrote:
> On 08/24/2012 08:17 PM, Christoph Lameter wrote:
>> -__kmem_cache_create (struct kmem_cache *cachep, const char *name, size_t size, size_t align,
>> -	unsigned long flags, void (*ctor)(void *))
>> +__kmem_cache_create (struct kmem_cache *cachep, unsigned long flags)
>>  {
>>  	size_t left_over, slab_size, ralign;
>>  	gfp_t gfp;
>> @@ -2385,9 +2383,9 @@ __kmem_cache_create (struct kmem_cache *
>>  	 * unaligned accesses for some archs when redzoning is used, and makes
>>  	 * sure any on-slab bufctl's are also correctly aligned.
>>  	 */
>> -	if (size & (BYTES_PER_WORD - 1)) {
>> -		size += (BYTES_PER_WORD - 1);
>> -		size &= ~(BYTES_PER_WORD - 1);
>> +	if (cachep->size & (BYTES_PER_WORD - 1)) {
>> +		cachep->size += (BYTES_PER_WORD - 1);
>> +		cachep->size &= ~(BYTES_PER_WORD - 1);
>>  	}
> 
> There are still one reference to "size" inside this function that will
> break the build. This reference is enclosed inside CONFIG_DEBUG.
> 

Actually, Christoph, it would be a lot cleaner if you would just do

   size_t size = cachep->size;

in the beginning of this function. The resulting patch size would be a
lot smaller since you don't need to patch the references, and would
avoid mistakes like that altogether.


--
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]