[lkml]   [2011]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: Regarding memory fragmentation using malloc....
    On Wed, Apr 13, 2011 at 2:54 PM, Pintu Agarwal <> wrote:
    > Dear All,
    > I am trying to understand how memory fragmentation occurs in linux using many malloc calls.
    > I am trying to reproduce the page fragmentation problem in linux 2.6.29.x on a linux mobile(without Swap) using a small malloc(in loop) test program of BLOCK_SIZE (64*(4*K)).
    > And then monitoring the page changes in /proc/buddyinfo after each operation.
    > From the output I can see that the page values under buddyinfo keeps changing. But I am not able to relate these changes with my malloc BLOCK_SIZE.
    > I mean with my BLOCK_SIZE of (2^6 x 4K ==> 2^6 PAGES) the 2^6 th block under /proc/buddyinfo should change. But this is not the actual behaviour.
    > Whatever is the blocksize, the buddyinfo changes only for 2^0 or 2^1 or 2^2 or 2^3.
    > I am trying to measure the level of fragmentation after each page allocation.
    > Can somebody explain me in detail, how actually /proc/buddyinfo changes after each allocation and deallocation.

    What malloc() sees is virtual memory of the process, while buddyinfo
    shows physical memory pages.

    When you malloc() 64K memory, the kernel may not allocate a 64K
    physical memory at one time
    for you.


     \ /
      Last update: 2011-04-13 13:47    [W:0.024 / U:12.452 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site