On Wed, Apr 14, 2010 at 10:18 AM, Manish Katiyar <mkati...@gmail.com> wrote:
> On Wed, Apr 14, 2010 at 8:04 PM, Vikash Kumar <vikashsku...@gmail.com> wrote:
>> Hi everyone,
>>
>> I am writing a simple memory manager for my application which will
>> free any excess memory being used by my modules, so that it's
>> available again for use. My modules allocate memory using alloc_page &
>> kmem_cache_alloc and so the memory manager uses put_page &
>> kmem_cache_free respectively to free up the memory which is not in
>> use.
>>
>> The problem I am facing is, even after I free the memory using
>> put_page & kmem_cache_free, my modules are not able to get the free
>> memory. I have written a test code which allocates a lot of memory in
>> loop and when out of memory sleeps on memory manager to free up the
>> memory. Memory manager successfully executes free code and wakes up
>> the sleeping process as memory should be available now. Interestingly
>> the alloc_page /  kmem_cache_alloc calls still fail to allocate
>> memory. Now, I am clueless why it is happening so seeking help.
>
> Random guess... Are you sure it is still free between your free and
> allocate. ie.. no one else comes in between takes away your memory ?
>
> Thanks -
> Manish
>
>

Slab allocator does not just free the pages when u call
kmem_cache_free. It has a list of empty, partial and full slabs. So if
yo free it will just be in free list. have you called
kmem_cache_destroy to destroy the whole cache?
correct me if i am wrong here.


---------------------------------------------------------------
regards
Manish Regmi

http://manish-cs.blogspot.com
http://ext2read.sf.net

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to