Behaviour of kernel memory allocation

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

 



I was trying to see how much I can really allocate memory in kernel space using "vmalloc". I used "kinfocenter"(the memory section) to monitor the changes. My laptop has 512MB phyical memory with a 1GB swap partition.

At the beginning, the system didn't have much free physical memory available(about %7 free), and rest of the physical memory is ocuppied by 'application data' and 'disk cache'. At this time, If I tried to allocate 100MB memory using 'vmalloc' (using a single variable to hold the memory), I would fail.  What I did was gradually increasing the amount of physical memory to allocate. So, I did: (1) allocate 20MB and free 20MB, (2) allocate 30MB and free 30MB, (3) allocate 50MB, free 50MB, and so on. As I increased the amount of memory to allocate, the portion of the 'disk cache' memory just gradually shrinked. And finally, I could allocate 120MB physical memory. I can't go up to 130MB, doesn't matter how much free physical memory is available in the system. I can't understand why it's happening.

After the above failure, I tried to use two variable to hold the allocated memory. I also gradually increased the amount of memory to allocate. And Finally, each variable could hold 120MB physical memory, which is 240MB in total. And then, I tried to allocate 130MB to each variable, I failed. It seemed that 120MB is the maximum memory a single variable can hold for a system with 512MB physical memory available. I don't know if my observation can apply to general.

So, I'm interested in knowing if there is a kernel function call to shrink the kernel caches before I want to allocate huge amount of memory in a single step, rather than gradually shrink the caches to make more memory available.

And how can I know how much memory a varialbe can hold in general?

Thanks for your patient to read these a lot of words.


[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