On Mon, 14 Apr 2014 19:23:34 +0200 (CEST) Sebastian Ott 
<seb...@linux.vnet.ibm.com> wrote:

> 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.
> 
> ..
>
> @@ -200,6 +201,7 @@ void * mempool_alloc(mempool_t *pool, gf
>       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 */

hm, BUG is a bit harsh.  How about

--- a/mm/mempool.c~mm-mempool-warn-about-__gfp_zero-usage-fix
+++ a/mm/mempool.c
@@ -201,7 +201,9 @@ void * mempool_alloc(mempool_t *pool, gf
        wait_queue_t wait;
        gfp_t gfp_temp;
 
-       VM_BUG_ON(gfp_mask & __GFP_ZERO);
+#ifdef CONFIG_DEBUG_VM
+       WARN_ON_ONCE(gfp_mask & __GFP_ZERO);    /* Where's VM_WARN_ON_ONCE()? */
+#endif
        might_sleep_if(gfp_mask & __GFP_WAIT);
 
        gfp_mask |= __GFP_NOMEMALLOC;   /* don't allocate emergency reserves */

?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to