diff options
author | Joonsoo Kim <js1304@gmail.com> | 2012-12-12 16:50:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-12 20:38:31 -0500 |
commit | 3f7dfe24b84c0ad698c461fc9c4ba3544bbfcebf (patch) | |
tree | b05abd7ad979dc4060c5e89e4078aa827e7efe82 /mm | |
parent | 2d7a695604556913d9ef1ead47881b804d6c52b4 (diff) |
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>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/bootmem.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/mm/bootmem.c b/mm/bootmem.c index 4730931b45a9..26d057a8b552 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c | |||
@@ -575,15 +575,6 @@ find_block: | |||
575 | return NULL; | 575 | return NULL; |
576 | } | 576 | } |
577 | 577 | ||
578 | static void * __init alloc_arch_preferred_bootmem(bootmem_data_t *bdata, | ||
579 | unsigned long size, unsigned long align, | ||
580 | unsigned long goal, unsigned long limit) | ||
581 | { | ||
582 | if (WARN_ON_ONCE(slab_is_available())) | ||
583 | return kzalloc(size, GFP_NOWAIT); | ||
584 | return NULL; | ||
585 | } | ||
586 | |||
587 | static void * __init alloc_bootmem_core(unsigned long size, | 578 | static void * __init alloc_bootmem_core(unsigned long size, |
588 | unsigned long align, | 579 | unsigned long align, |
589 | unsigned long goal, | 580 | unsigned long goal, |
@@ -592,9 +583,8 @@ static void * __init alloc_bootmem_core(unsigned long size, | |||
592 | bootmem_data_t *bdata; | 583 | bootmem_data_t *bdata; |
593 | void *region; | 584 | void *region; |
594 | 585 | ||
595 | region = alloc_arch_preferred_bootmem(NULL, size, align, goal, limit); | 586 | if (WARN_ON_ONCE(slab_is_available())) |
596 | if (region) | 587 | return kzalloc(size, GFP_NOWAIT); |
597 | return region; | ||
598 | 588 | ||
599 | list_for_each_entry(bdata, &bdata_list, list) { | 589 | list_for_each_entry(bdata, &bdata_list, list) { |
600 | if (goal && bdata->node_low_pfn <= PFN_DOWN(goal)) | 590 | if (goal && bdata->node_low_pfn <= PFN_DOWN(goal)) |
@@ -692,11 +682,9 @@ void * __init ___alloc_bootmem_node_nopanic(pg_data_t *pgdat, | |||
692 | { | 682 | { |
693 | void *ptr; | 683 | void *ptr; |
694 | 684 | ||
685 | if (WARN_ON_ONCE(slab_is_available())) | ||
686 | return kzalloc(size, GFP_NOWAIT); | ||
695 | again: | 687 | again: |
696 | ptr = alloc_arch_preferred_bootmem(pgdat->bdata, size, | ||
697 | align, goal, limit); | ||
698 | if (ptr) | ||
699 | return ptr; | ||
700 | 688 | ||
701 | /* do not panic in alloc_bootmem_bdata() */ | 689 | /* do not panic in alloc_bootmem_bdata() */ |
702 | if (limit && goal + size > limit) | 690 | if (limit && goal + size > limit) |