kmalloc and get_free_pages

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

 



Hello,

I was wondering - kmalloc directly uses the kmem_cache caches (i.e. the geometrically distributed
caches).  These specific caches include caches of 4096bytes (a page of memory), 8192bytes (2
pages), all the way up to 131072bytes (32 pages).  Now the caches get their memory slabs from
get_free_pages.   get_free_pages already has functionality to allocate a page (4096bytes), 2
pages, 4 pages, all the way up to 512 pages.  To me there is a redundancy of allocating physically
contiguous memory sizes of 1 page to 32 pages.  Both kmalloc and get_free_pages can do it, but
calling get_free_pages is faster than calling kmalloc to get the same amount of memory.  I can
think of some reasons to have it this way but they basically all come down to convenience.  Can
anyone tell me if there is a specific reason for this?


TIA
-Peter

__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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