lkml.org 
[lkml]   [1997]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectMemory Leak Fix
Hi David/All,

Please find attached a diff against the slab allocator for 2.1.42

This contains the changes for the "Debugging Slab", which was on my
homepage, but with the debugging disabled.

Most importantly, it contains a fix for the memory leak.

This occured when a slab contained only one object (ie. the object is
_large_). __kmem_cache_free() use to check for a fully free slab,
and then for a first-free from a fully active slab (this is to maintain
the partial ordering of slabs with a cache).

kmem_cache_full_free() makes the assumption that 'c_freep' refers to
the slab being moved, or to a slab which appears earlier in the ordering.
Unfortunately, this is not true for single object slabs, as 'c_freep' can
refer to a later slab (or even the cache head). If the slab does _not_
need to be moved (to maintain the ordering), it does not update 'c_freep'
- which caused the leak.

The fix is to change the testing order in __kmem_cache_free(), so that the
test for 'first-object-free' is made before the 'fully-free' test.


Regards,

markhe


----------------------------------------------------
Mark Hemment UNIX/C Sotware Engineer (contractor)
"Success has many fathers. Failure is a b**tard"
----------------------------------------------------
[unhandled content-type:application/octet-stream]
\
 
 \ /
  Last update: 2005-03-22 13:39    [W:4.118 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site