From b0c9778b1d07ed3aa7e411db201275553527b1b1 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Fri, 9 Apr 2010 18:57:01 +0900 Subject: percpu: implement kernel memory based chunk allocation Implement an alternate percpu chunk management based on kernel memeory for nommu SMP architectures. Instead of mapping into vmalloc area, chunks are allocated as a contiguous kernel memory using alloc_pages(). As such, percpu allocator on nommu will have the following restrictions. * It can't fill chunks on-demand page-by-page. It has to allocate each chunk fully upfront. * It can't support sparse chunk for NUMA configurations. SMP w/o mmu is crazy enough. Let's hope no one does NUMA w/o mmu. :-P * If chunk size isn't power-of-two multiple of PAGE_SIZE, the unaligned amount will be wasted on each chunk. So, archs which use this better align chunk size. For instructions on how to use this, read the comment on top of mm/percpu-km.c. Signed-off-by: Tejun Heo Reviewed-by: David Howells Cc: Graff Yang Cc: Sonic Zhang --- mm/percpu.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mm/percpu.c') diff --git a/mm/percpu.c b/mm/percpu.c index 15f68043067..39f7dfd5958 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -654,7 +654,11 @@ static void pcpu_destroy_chunk(struct pcpu_chunk *chunk); static struct page *pcpu_addr_to_page(void *addr); static int __init pcpu_verify_alloc_info(const struct pcpu_alloc_info *ai); +#ifdef CONFIG_NEED_PER_CPU_KM +#include "percpu-km.c" +#else #include "percpu-vm.c" +#endif /** * pcpu_chunk_addr_search - determine chunk containing specified address -- cgit v1.2.3-70-g09d2