mempool.c (00170fdd0846df7cdb5ad421d3a340440f930b8f) | mempool.c (174119628188b085c66fe7d86fbfb4cccb1bd864) |
---|---|
1/* 2 * linux/mm/mempool.c 3 * 4 * memory buffer pool support. Such pools are mostly used 5 * for guaranteed, deadlock-free memory allocations during 6 * extreme VM load. 7 * 8 * started by Ingo Molnar, Copyright (C) 2001 9 */ 10 11#include <linux/mm.h> 12#include <linux/slab.h> | 1/* 2 * linux/mm/mempool.c 3 * 4 * memory buffer pool support. Such pools are mostly used 5 * for guaranteed, deadlock-free memory allocations during 6 * extreme VM load. 7 * 8 * started by Ingo Molnar, Copyright (C) 2001 9 */ 10 11#include <linux/mm.h> 12#include <linux/slab.h> |
13#include <linux/kmemleak.h> |
|
13#include <linux/export.h> 14#include <linux/mempool.h> 15#include <linux/blkdev.h> 16#include <linux/writeback.h> 17 18static void add_element(mempool_t *pool, void *element) 19{ 20 BUG_ON(pool->curr_nr >= pool->min_nr); --- 196 unchanged lines hidden (view full) --- 217 return element; 218 219 spin_lock_irqsave(&pool->lock, flags); 220 if (likely(pool->curr_nr)) { 221 element = remove_element(pool); 222 spin_unlock_irqrestore(&pool->lock, flags); 223 /* paired with rmb in mempool_free(), read comment there */ 224 smp_wmb(); | 14#include <linux/export.h> 15#include <linux/mempool.h> 16#include <linux/blkdev.h> 17#include <linux/writeback.h> 18 19static void add_element(mempool_t *pool, void *element) 20{ 21 BUG_ON(pool->curr_nr >= pool->min_nr); --- 196 unchanged lines hidden (view full) --- 218 return element; 219 220 spin_lock_irqsave(&pool->lock, flags); 221 if (likely(pool->curr_nr)) { 222 element = remove_element(pool); 223 spin_unlock_irqrestore(&pool->lock, flags); 224 /* paired with rmb in mempool_free(), read comment there */ 225 smp_wmb(); |
226 /* 227 * Update the allocation stack trace as this is more useful 228 * for debugging. 229 */ 230 kmemleak_update_trace(element); |
|
225 return element; 226 } 227 228 /* 229 * We use gfp mask w/o __GFP_WAIT or IO for the first round. If 230 * alloc failed with that and @pool was empty, retry immediately. 231 */ 232 if (gfp_temp != gfp_mask) { --- 141 unchanged lines hidden --- | 231 return element; 232 } 233 234 /* 235 * We use gfp mask w/o __GFP_WAIT or IO for the first round. If 236 * alloc failed with that and @pool was empty, retry immediately. 237 */ 238 if (gfp_temp != gfp_mask) { --- 141 unchanged lines hidden --- |