Re: query related to kmalloc()

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

 



On Mon, Aug 29, 2005 at 04:22:28PM +0530, Gaurav Dhiman wrote:
> On 8/29/05, Erik Mouw <J.A.K.Mouw@xxxxxxxxxxxxxx> wrote:
> > On Mon, Aug 29, 2005 at 12:03:51PM +0530, Gaurav Dhiman wrote:
> > > As kmalloc() allocates the memory in terms of page size (4k), atleast
> > > 4K will be allocated for each kmalloc() call in above case. On other
> > > side, wont it be good idea to get one page allocated with kmalloc()
> > > and then use it to store an array of our 10 byte structure and if we
> > > need more we can get one more page allocated with kmalloc(). In this
> > > way we can have list of kmalloc'ed pages and each page represents the
> > > array of out 10 byte strucutre.
> > 
> > kmalloc() will use the slab allocator, 10 byte structures will go into
> > the "size-32" slab, so only 22 bytes are wasted.
> 
> What is this, can you point me to some articles on slab allocator
> ..... I am not aware of it.

There's a Usenix paper about it, see the comments in mm/slab.c for
exact details.

You can also run "make pdfdocs|psdocs|htmldocs" in your kernel tree to
get the kernel-api book in Documentation/DocBook/ for a complete
reference to the slab allocator functions (this does NOT tell the
idea's behind the slab, it only documents the functions).

BTW, I'm sure Understanding the Linux Kernel and/or Linux Device
Drivers cover the slab allocator.


Erik

-- 
Erik Mouw
J.A.K.Mouw@xxxxxxxxxxxxxx  mouw@xxxxxxxxxxxx

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux