Re: about kmalloc and kmem_cache_alloc

2010-11-07 Thread John Mahoney
On Sat, Nov 6, 2010 at 2:09 AM, Rajat Sharma fs.ra...@gmail.com wrote: as i know,kmalloc is based on kmem_cache_alloc ,so what's the different? kmalloc uses the generic slab caches available to any kernel code. so your module will share slab cache with other components in kernel, but if you

Re: about kmalloc and kmem_cache_alloc

2010-11-07 Thread Rajat Sharma
Unless you are creating your own subsystem(or complex driver) and will be responsible for allocating a lot of one specific data structure there is no reason to create your own cache. Even in the driver case you will often know ahead of time the number of data structures to preallocate and

Re: Re: about kmalloc and kmem_cache_alloc

2010-11-07 Thread kernel.niko
thanks for all your guys, it's very clear . It's helpful Can you also explain when to use alloc_pages ? I wanna know in what case to use it in drivers. thanks again . as i know,kmalloc is based on kmem_cache_alloc ,so what's the different? kmalloc uses the generic slab caches available to

Re: Re: about kmalloc and kmem_cache_alloc

2010-11-07 Thread Rajat Sharma
Can you also explain when to use alloc_pages ? I wanna know in what case to use it in drivers. alloc_pages is zone allocator which implements buddy allocation algorithm. It is the basic allocation API. Following is the dependency call sequence: kmalloc() -- kmem_cahce_alloc() -- alloc_pages()

Re: about kmalloc and kmem_cache_alloc

2010-11-06 Thread Rajat Sharma
as i know,kmalloc is based on kmem_cache_alloc ,so what's the different? kmalloc uses the generic slab caches available to any kernel code. so your module will share slab cache with other components in kernel, but if you specifically want a better slab cache management dedicated to your module

Re: about kmalloc and kmem_cache_alloc

2010-11-05 Thread Mulyadi Santosa
Hi... On Fri, Nov 5, 2010 at 10:03, kernel.niko kernel.n...@gmail.com wrote: hi,everyone, I'm wandering how to use kmalloc and kmem_cache_alloc. as i know,kmalloc is based on kmem_cache_alloc ,so what's the different? when to use kmalloc? and in what occasion,kmem_cache_alloc should be used?

Re: about kmalloc and kmem_cache_alloc

2010-11-05 Thread Venkatram Tummala
On Thu, Nov 4, 2010 at 8:03 PM, kernel.niko kernel.n...@gmail.com wrote: hi,everyone, I'm wandering how to use kmalloc and kmem_cache_alloc. as i know,kmalloc is based on kmem_cache_alloc ,so what's the different? kmalloc should be used when you want to allocate byte sized memory as opposed to

about kmalloc and kmem_cache_alloc

2010-11-04 Thread kernel.niko
hi,everyone, I'm wandering how to use kmalloc and kmem_cache_alloc. as i know,kmalloc is based on kmem_cache_alloc ,so what's the different? when to use kmalloc? and in what occasion,kmem_cache_alloc should be used? thanks. 2010-11-05 kernel.niko