Skip to contentSkip to conversation

GFP_KERNEL doubt!! <was Tasklet doubt!>

DISCUSSION Sriram Narasimhan 1 participant 1 message Apr 11, 2003

lore
Share & tools
lore
#0 lore raw

Hello,

The problem of allocating more than 2.5 MB was actually more or less related to the physical memory left in the kernel. But I moved the task which allocated the memory from the tasklet to the keventd and used kmalloc (GFP_KERNEL).

The first time I ran my module, it failed at the same 2.5 MB limit.
I restarted the system and tried it again, and I was able to allocate 5 MB successfully. I restarted the system and ran "free".
The report is as follows:

            total       used       free     shared    buffers     cached
Mem:         62264      30624      31640          0       8072      16096
-/+ buffers/cache:       6456      55808

Swap: 192772 0 192772

Then I ran gcc and compiled my code and then for the "free" report again. The report is as follows:

            total       used       free     shared    buffers     cached
Mem:         62264      45320      16944          0       9256      28384
-/+ buffers/cache:       7680      54584

Swap: 192772 0 192772

I was able to notice that the physical memory had gone down though "gcc" had completed. The time I ran my application, I had about 2.5M physical memory left, so I was able to allocate 2.5M.

What is happening ? What is the buffers/cache column and is there any way I could force the kernel to release the cached memory back to free physical ? Is there any way I can allocate more than what is left free from the physical memory ?

Any pointers or suggestions would be very helpful.

Thank you.
Regards,
Sriram