diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2014-04-23 08:27:11 +1000 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2014-04-23 08:27:11 +1000 |
commit | 6b953f24692604df6d77697858eb56879e1634af (patch) | |
tree | 2eb690b5d1c9cba52b027c2b491a5bc8054c3348 /mm | |
parent | e34b12753482aba2dc7135c722a3de4d0a5167b5 (diff) |
mm/mempool: warn about __GFP_ZERO usage
Memory obtained via mempool_alloc is not always zeroed even when
called with __GFP_ZERO. Add a note and VM_BUG_ON statement to make
that clear.
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/mempool.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/mempool.c b/mm/mempool.c index 905434f18c97..e12664eaaf58 100644 --- a/mm/mempool.c +++ b/mm/mempool.c @@ -192,6 +192,7 @@ EXPORT_SYMBOL(mempool_resize); * returns NULL. Note that due to preallocation, this function * *never* fails when called from process contexts. (it might * fail if called from an IRQ context.) + * Note: using __GFP_ZERO is not supported. */ void * mempool_alloc(mempool_t *pool, gfp_t gfp_mask) { @@ -200,6 +201,7 @@ void * mempool_alloc(mempool_t *pool, gfp_t gfp_mask) wait_queue_t wait; gfp_t gfp_temp; + VM_BUG_ON(gfp_mask & __GFP_ZERO); might_sleep_if(gfp_mask & __GFP_WAIT); gfp_mask |= __GFP_NOMEMALLOC; /* don't allocate emergency reserves */ |