Re: kmalloc query

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

 



On Wed, Jul 15, 2009 at 5:37 PM, aniket agashe<agasheac@xxxxxxxxx> wrote:
> hi
>
>
>        if i allocated memory less than PAGE_SIZE using kmalloc then is there
> any possibility of lying that memory on the two pages
> i know its silly question but i dont know exact implementation of kmalloc.

Hi Aniket...I hope you don't mind if I cc the reply to kernelnewbies list.

My understanding in this case: yes it's possible. As you might know,
kmalloc is implemented on top of slob/slub/slab layer, thus we see
page as a union of tiny fragments. Whenever allocation is requested,
it will be satisfied by contigous free objects and it is possible that
it spans beyond PAGE_SIZE

However, what I can't really tell is the effect of so called slab
coloring and the allocation policy based on it. IIRC, this "coloring"
is the way to mark the cache hotness. Another thing that might affect
memory allocation is alignment issue. If you're given a choice between
aligned (to L1 or L2 cache) block of memory or non aligned one, I
believe kernel will choose to pick the aligned one.

Someone please CMIIW.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer
blog: the-hydra.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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