[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20140416141556.d50eef60d955d724ba1b02de@linux-foundation.org>
Date: Wed, 16 Apr 2014 14:15:56 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Sebastian Ott <sebott@...ux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@...nel.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/mempool: warn about __GFP_ZERO usage
On Mon, 14 Apr 2014 19:23:34 +0200 (CEST) Sebastian Ott <sebott@...ux.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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists