From: Sebastian Ott Date: Thu, 22 May 2014 00:42:48 +0000 (+1000) Subject: mm/mempool: warn about __GFP_ZERO usage X-Git-Tag: next-20140530~2^2~364 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=79cc286d74e397364e4732b14dd998f4b1913979;p=karo-tx-linux.git 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 Signed-off-by: Andrew Morton --- 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 */