Re: [PATCH -mm] add a kmem_cache for nsproxy objects

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

 



Christoph Lameter wrote:
> On Tue, 19 Jun 2007, Andrew Morton wrote:
> 
>> On Mon, 18 Jun 2007 22:53:13 +0200
>> Cedric Le Goater <[email protected]> wrote:
>>
>>> +static int __init nsproxy_cache_init(void)
>>> +{
>>> +	nsproxy_cachep = kmem_cache_create("nsproxy", sizeof(struct nsproxy),
>>> +					   0, SLAB_PANIC, NULL, NULL);
>>> +	return 0;
>>> +}
>>> +
>> Christoph added this cheesy KMEM_CACHE macro.  But I don't immediately recall
>> the rationale so I'm a bit reluctant to ask people to use-the-cheesy-macro.
>>
>> Perhaps he can remind us why it is there?
> 
> Because it simplifies the handling of slabs.
> 
> The above will could become:
> 
> nsproxy_cachep = KMEM_CACHE(nsproxy, SLAB_PANIC);
> 
> meaning create a cache for the nsproxy struct, the nsproxy name and the 
> nsproxy size. See include/linux/slab.h.

yes, I should probably use that for the nsproxy struct.

my 2cts :
  
the macro sets the align parameter to "__alignof__(struct)" by default. 
is that something we want to do all the time ? if so, why not change 
kmem_cache_create() directly ?

Most of the complexity is in flags. I did a grep and picked what i thought 
was the most aggressive. The macro would probably be more useful if we could 
identify by it's name in which context it can be used. 


C.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux