Commit 3cbc85652767c38b252c8de55f9fd180b29e4c0d
1 parent
1d9d325721
Exists in
master
and in
20 other branches
percpu: add @align to pcpu_fc_alloc_fn_t
pcpu_fc_alloc_fn_t is about to see more interesting usage, add @align parameter. Signed-off-by: Tejun Heo <tj@kernel.org>
Showing 3 changed files with 6 additions and 5 deletions Side-by-side Diff
arch/x86/kernel/setup_percpu.c
... | ... | @@ -126,9 +126,9 @@ |
126 | 126 | /* |
127 | 127 | * Helpers for first chunk memory allocation |
128 | 128 | */ |
129 | -static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size) | |
129 | +static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size, size_t align) | |
130 | 130 | { |
131 | - return pcpu_alloc_bootmem(cpu, size, size); | |
131 | + return pcpu_alloc_bootmem(cpu, size, align); | |
132 | 132 | } |
133 | 133 | |
134 | 134 | static void __init pcpu_fc_free(void *ptr, size_t size) |
include/linux/percpu.h
... | ... | @@ -71,7 +71,8 @@ |
71 | 71 | |
72 | 72 | extern enum pcpu_fc pcpu_chosen_fc; |
73 | 73 | |
74 | -typedef void * (*pcpu_fc_alloc_fn_t)(unsigned int cpu, size_t size); | |
74 | +typedef void * (*pcpu_fc_alloc_fn_t)(unsigned int cpu, size_t size, | |
75 | + size_t align); | |
75 | 76 | typedef void (*pcpu_fc_free_fn_t)(void *ptr, size_t size); |
76 | 77 | typedef void (*pcpu_fc_populate_pte_fn_t)(unsigned long addr); |
77 | 78 | typedef int (pcpu_fc_cpu_distance_fn_t)(unsigned int from, unsigned int to); |
mm/percpu.c
... | ... | @@ -1578,7 +1578,7 @@ |
1578 | 1578 | for (i = 0; i < unit_pages; i++) { |
1579 | 1579 | void *ptr; |
1580 | 1580 | |
1581 | - ptr = alloc_fn(cpu, PAGE_SIZE); | |
1581 | + ptr = alloc_fn(cpu, PAGE_SIZE, PAGE_SIZE); | |
1582 | 1582 | if (!ptr) { |
1583 | 1583 | pr_warning("PERCPU: failed to allocate %s page " |
1584 | 1584 | "for cpu%u\n", psize_str, cpu); |
... | ... | @@ -1888,7 +1888,7 @@ |
1888 | 1888 | goto found; |
1889 | 1889 | continue; |
1890 | 1890 | found: |
1891 | - ptr = alloc_fn(cpu, lpage_size); | |
1891 | + ptr = alloc_fn(cpu, lpage_size, lpage_size); | |
1892 | 1892 | if (!ptr) { |
1893 | 1893 | pr_warning("PERCPU: failed to allocate large page " |
1894 | 1894 | "for cpu%u\n", cpu); |