The inline path seems to have changed the SLAB behavior for very large
kmalloc allocations with commit
e3366016 ("slab: Use common
kmalloc_index/kmalloc_size functions"). This patch restores the old
behavior but also adds diagnostics so that we can figure where in the
code these large allocations occur.
Reported-and-tested-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Christoph Lameter <cl@linux.com>
Link: http://lkml.kernel.org/r/201305040348.CIF81716.OStQOHFJMFLOVF@I-love.SAKURA.ne.jp
[ penberg@kernel.org: use WARN_ON_ONCE ]
Signed-off-by: Pekka Enberg <penberg@kernel.org>
if (!size)
return ZERO_SIZE_PTR;
+ if (WARN_ON_ONCE(size > KMALLOC_MAX_SIZE))
+ return NULL;
+
i = kmalloc_index(size);
#ifdef CONFIG_ZONE_DMA
if (!size)
return ZERO_SIZE_PTR;
+ if (WARN_ON_ONCE(size > KMALLOC_MAX_SIZE))
+ return NULL;
+
i = kmalloc_index(size);
#ifdef CONFIG_ZONE_DMA
{
int index;
+ if (WARN_ON_ONCE(size > KMALLOC_MAX_SIZE))
+ return NULL;
+
if (size <= 192) {
if (!size)
return ZERO_SIZE_PTR;