mm: kmemleak: Don't die when memory allocation fails
When memory is leaking, it's going to be harder to allocate more memory, making it more likely for this failure condition inside of kmemleak to manifest itself. This is extremely frustrating since kmemleak kills itself upon the first instance of memory allocation failure. Bypass that and make kmemleak more resilient when memory is running low. Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com> Signed-off-by: priiii1808 <priyanshusinghal0818@gmail.com>
This commit is contained in:
parent
1c19be24ee
commit
b8eba3b6e6
1 changed files with 6 additions and 3 deletions
|
@ -421,10 +421,13 @@ static struct kmemleak_object *mem_pool_alloc(gfp_t gfp)
|
|||
|
||||
/* try the slab allocator first */
|
||||
if (object_cache) {
|
||||
object = kmem_cache_alloc(object_cache, gfp_kmemleak_mask(gfp));
|
||||
while (1) {
|
||||
object = kmem_cache_alloc(object_cache,
|
||||
gfp_kmemleak_mask(gfp));
|
||||
if (object)
|
||||
return object;
|
||||
}
|
||||
}
|
||||
|
||||
/* slab allocation failed, try the memory pool */
|
||||
raw_spin_lock_irqsave(&kmemleak_lock, flags);
|
||||
|
|
Loading…
Reference in a new issue