bootmem: remove alloc_arch_preferred_bootmem()

The name of this function is not suitable, and removing the function and
open-coding it into each call sites makes the code more understandable.

Additionally, we shouldn't do an allocation from bootmem when
slab_is_available(), so directly return kmalloc()'s return value.

Signed-off-by: Joonsoo Kim <js1304@gmail.com>
Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Joonsoo Kim 2012-12-12 13:50:43 -08:00 коммит произвёл Linus Torvalds
Родитель 2d7a695604
Коммит 3f7dfe24b8
1 изменённых файлов: 4 добавлений и 16 удалений

Просмотреть файл

@ -575,15 +575,6 @@ find_block:
return NULL; return NULL;
} }
static void * __init alloc_arch_preferred_bootmem(bootmem_data_t *bdata,
unsigned long size, unsigned long align,
unsigned long goal, unsigned long limit)
{
if (WARN_ON_ONCE(slab_is_available()))
return kzalloc(size, GFP_NOWAIT);
return NULL;
}
static void * __init alloc_bootmem_core(unsigned long size, static void * __init alloc_bootmem_core(unsigned long size,
unsigned long align, unsigned long align,
unsigned long goal, unsigned long goal,
@ -592,9 +583,8 @@ static void * __init alloc_bootmem_core(unsigned long size,
bootmem_data_t *bdata; bootmem_data_t *bdata;
void *region; void *region;
region = alloc_arch_preferred_bootmem(NULL, size, align, goal, limit); if (WARN_ON_ONCE(slab_is_available()))
if (region) return kzalloc(size, GFP_NOWAIT);
return region;
list_for_each_entry(bdata, &bdata_list, list) { list_for_each_entry(bdata, &bdata_list, list) {
if (goal && bdata->node_low_pfn <= PFN_DOWN(goal)) if (goal && bdata->node_low_pfn <= PFN_DOWN(goal))
@ -692,11 +682,9 @@ void * __init ___alloc_bootmem_node_nopanic(pg_data_t *pgdat,
{ {
void *ptr; void *ptr;
if (WARN_ON_ONCE(slab_is_available()))
return kzalloc(size, GFP_NOWAIT);
again: again:
ptr = alloc_arch_preferred_bootmem(pgdat->bdata, size,
align, goal, limit);
if (ptr)
return ptr;
/* do not panic in alloc_bootmem_bdata() */ /* do not panic in alloc_bootmem_bdata() */
if (limit && goal + size > limit) if (limit && goal + size > limit)