aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/percpu.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/percpu.h')
-rw-r--r--include/linux/percpu.h39
1 files changed, 37 insertions, 2 deletions
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 18080995ff3e..910beb0abea2 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -78,12 +78,47 @@
78 78
79#ifdef CONFIG_HAVE_DYNAMIC_PER_CPU_AREA 79#ifdef CONFIG_HAVE_DYNAMIC_PER_CPU_AREA
80 80
81/* minimum unit size, also is the maximum supported allocation size */
82#define PCPU_MIN_UNIT_SIZE (16UL << PAGE_SHIFT)
83
84/*
85 * PERCPU_DYNAMIC_RESERVE indicates the amount of free area to piggy
86 * back on the first chunk if arch is manually allocating and mapping
87 * it for faster access (as a part of large page mapping for example).
88 * Note that dynamic percpu allocator covers both static and dynamic
89 * areas, so these values are bigger than PERCPU_MODULE_RESERVE.
90 *
91 * On typical configuration with modules, the following values leave
92 * about 8k of free space on the first chunk after boot on both x86_32
93 * and 64 when module support is enabled. When module support is
94 * disabled, it's much tighter.
95 */
96#ifndef PERCPU_DYNAMIC_RESERVE
97# if BITS_PER_LONG > 32
98# ifdef CONFIG_MODULES
99# define PERCPU_DYNAMIC_RESERVE (6 << PAGE_SHIFT)
100# else
101# define PERCPU_DYNAMIC_RESERVE (4 << PAGE_SHIFT)
102# endif
103# else
104# ifdef CONFIG_MODULES
105# define PERCPU_DYNAMIC_RESERVE (4 << PAGE_SHIFT)
106# else
107# define PERCPU_DYNAMIC_RESERVE (2 << PAGE_SHIFT)
108# endif
109# endif
110#endif /* PERCPU_DYNAMIC_RESERVE */
111
81extern void *pcpu_base_addr; 112extern void *pcpu_base_addr;
82 113
114typedef struct page * (*pcpu_get_page_fn_t)(unsigned int cpu, int pageno);
83typedef void (*pcpu_populate_pte_fn_t)(unsigned long addr); 115typedef void (*pcpu_populate_pte_fn_t)(unsigned long addr);
84 116
85extern size_t __init pcpu_setup_static(pcpu_populate_pte_fn_t populate_pte_fn, 117extern size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn,
86 struct page **pages, size_t cpu_size); 118 size_t static_size, size_t unit_size,
119 size_t free_size, void *base_addr,
120 pcpu_populate_pte_fn_t populate_pte_fn);
121
87/* 122/*
88 * Use this to get to a cpu's version of the per-cpu object 123 * Use this to get to a cpu's version of the per-cpu object
89 * dynamically allocated. Non-atomic access to the current CPU's 124 * dynamically allocated. Non-atomic access to the current CPU's