Re: [PATCH] mm, slab: rename kmalloc-node cache to kmalloc-<size>

From: Vlastimil Babka
Date: Thu Feb 09 2017 - 04:36:32 EST


On 02/08/2017 10:54 PM, Andrew Morton wrote:
> On Wed, 8 Feb 2017 10:12:13 +0100 Vlastimil Babka <vbabka@xxxxxxx> wrote:
>
>> Thanks for the fix.
>>
>> I was going to implement Christoph's suggestion and export the whole structure
>> in mm/slab.h, but gcc was complaining that I'm redefining it, until I created a
>> typedef first. Is it worth the trouble? Below is how it would look like.
>>
>> ...
>>
>> --- a/mm/slab.h
>> +++ b/mm/slab.h
>> @@ -71,6 +71,13 @@ extern struct list_head slab_caches;
>> /* The slab cache that manages slab cache information */
>> extern struct kmem_cache *kmem_cache;
>>
>> +/* A table of kmalloc cache names and sizes */
>> +typedef struct {
>> + const char *name;
>> + unsigned long size;
>> +} kmalloc_info_t;
>> +extern const kmalloc_info_t kmalloc_info[];
>
> Why is the typedef needed? Can't we use something like

Duh, right, I can't C. Thanks.

----8<----