aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/percpu.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-07-03 19:11:00 -0400
committerTejun Heo <tj@kernel.org>2009-07-03 19:11:00 -0400
commitce3141a277ff6cc37e51008b8888dc2cb7456ef1 (patch)
tree8bd43d595d85fa37de5f3a7030580aa56b590028 /include/linux/percpu.h
parentc8a51be4cabb7009db5f865169389242d49c4c60 (diff)
percpu: drop pcpu_chunk->page[]
percpu core doesn't need to tack all the allocated pages. It needs to know whether certain pages are populated and a way to reverse map address to page when freeing. This patch drops pcpu_chunk->page[] and use populated bitmap and vmalloc_to_page() lookup instead. Using vmalloc_to_page() exclusively is also possible but complicates first chunk handling, inflates cache footprint and prevents non-standard memory allocation for percpu memory. pcpu_chunk->page[] was used to track each page's allocation and allowed asymmetric population which happens during failure path; however, with single bitmap for all units, this is no longer possible. Bite the bullet and rewrite (de)populate functions so that things are done in clearly separated steps such that asymmetric population doesn't happen. This makes the (de)population process much more modular and will also ease implementing non-standard memory usage in the future (e.g. large pages). This makes @get_page_fn parameter to pcpu_setup_first_chunk() unnecessary. The parameter is dropped and all first chunk helpers are updated accordingly. Please note that despite the volume most changes to first chunk helpers are symbol renames for variables which don't need to be referenced outside of the helper anymore. This change reduces memory usage and cache footprint of pcpu_chunk. Now only #unit_pages bits are necessary per chunk. [ Impact: reduced memory usage and cache footprint for bookkeeping ] Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: David Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/percpu.h')
-rw-r--r--include/linux/percpu.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index ec64357e1762..63c8b7a23e66 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -58,13 +58,12 @@
58 58
59extern void *pcpu_base_addr; 59extern void *pcpu_base_addr;
60 60
61typedef struct page * (*pcpu_get_page_fn_t)(unsigned int cpu, int pageno);
62typedef void * (*pcpu_fc_alloc_fn_t)(unsigned int cpu, size_t size); 61typedef void * (*pcpu_fc_alloc_fn_t)(unsigned int cpu, size_t size);
63typedef void (*pcpu_fc_free_fn_t)(void *ptr, size_t size); 62typedef void (*pcpu_fc_free_fn_t)(void *ptr, size_t size);
64typedef void (*pcpu_fc_populate_pte_fn_t)(unsigned long addr); 63typedef void (*pcpu_fc_populate_pte_fn_t)(unsigned long addr);
65typedef void (*pcpu_fc_map_fn_t)(void *ptr, size_t size, void *addr); 64typedef void (*pcpu_fc_map_fn_t)(void *ptr, size_t size, void *addr);
66 65
67extern size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn, 66extern size_t __init pcpu_setup_first_chunk(
68 size_t static_size, size_t reserved_size, 67 size_t static_size, size_t reserved_size,
69 ssize_t dyn_size, size_t unit_size, 68 ssize_t dyn_size, size_t unit_size,
70 void *base_addr); 69 void *base_addr);