diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2014-06-04 19:07:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-04 19:53:58 -0400 |
commit | 8bf8fcb07653fbaea74f96bba1e4ed0f851675ab (patch) | |
tree | 6412234c0fea986db2c88874221c42bf56c7acff /mm/mempool.c | |
parent | 02a8efeda894d3541c7143ed818b25b299504190 (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.
[akpm@linux-foundation.org: use VM_WARN_ON_ONCE]
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mempool.c')
-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..455d468c3a5d 100644 --- a/mm/mempool.c +++ b/mm/mempool.c | |||
@@ -192,6 +192,7 @@ EXPORT_SYMBOL(mempool_resize); | |||
192 | * returns NULL. Note that due to preallocation, this function | 192 | * returns NULL. Note that due to preallocation, this function |
193 | * *never* fails when called from process contexts. (it might | 193 | * *never* fails when called from process contexts. (it might |
194 | * fail if called from an IRQ context.) | 194 | * fail if called from an IRQ context.) |
195 | * Note: using __GFP_ZERO is not supported. | ||
195 | */ | 196 | */ |
196 | void * mempool_alloc(mempool_t *pool, gfp_t gfp_mask) | 197 | void * mempool_alloc(mempool_t *pool, gfp_t gfp_mask) |
197 | { | 198 | { |
@@ -200,6 +201,7 @@ void * mempool_alloc(mempool_t *pool, gfp_t gfp_mask) | |||
200 | wait_queue_t wait; | 201 | wait_queue_t wait; |
201 | gfp_t gfp_temp; | 202 | gfp_t gfp_temp; |
202 | 203 | ||
204 | VM_WARN_ON_ONCE(gfp_mask & __GFP_ZERO); | ||
203 | might_sleep_if(gfp_mask & __GFP_WAIT); | 205 | might_sleep_if(gfp_mask & __GFP_WAIT); |
204 | 206 | ||
205 | gfp_mask |= __GFP_NOMEMALLOC; /* don't allocate emergency reserves */ | 207 | gfp_mask |= __GFP_NOMEMALLOC; /* don't allocate emergency reserves */ |