diff options
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.17/0157-percpu-x86-don-t-use-PMD_SIZE-as-embedded-atom_size-.patch')
-rw-r--r-- | recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.17/0157-percpu-x86-don-t-use-PMD_SIZE-as-embedded-atom_size-.patch | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.17/0157-percpu-x86-don-t-use-PMD_SIZE-as-embedded-atom_size-.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.17/0157-percpu-x86-don-t-use-PMD_SIZE-as-embedded-atom_size-.patch new file mode 100644 index 00000000..c948145d --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.17/0157-percpu-x86-don-t-use-PMD_SIZE-as-embedded-atom_size-.patch | |||
@@ -0,0 +1,68 @@ | |||
1 | From 40bfc308a453997d543e78d6c825275710c48a1c Mon Sep 17 00:00:00 2001 | ||
2 | From: Tejun Heo <tj@kernel.org> | ||
3 | Date: Fri, 27 Apr 2012 10:54:35 -0700 | ||
4 | Subject: [PATCH 157/165] percpu, x86: don't use PMD_SIZE as embedded | ||
5 | atom_size on 32bit | ||
6 | |||
7 | commit d5e28005a1d2e67833852f4c9ea8ec206ea3ff85 upstream. | ||
8 | |||
9 | With the embed percpu first chunk allocator, x86 uses either PAGE_SIZE | ||
10 | or PMD_SIZE for atom_size. PMD_SIZE is used when CPU supports PSE so | ||
11 | that percpu areas are aligned to PMD mappings and possibly allow using | ||
12 | PMD mappings in vmalloc areas in the future. Using larger atom_size | ||
13 | doesn't waste actual memory; however, it does require larger vmalloc | ||
14 | space allocation later on for !first chunks. | ||
15 | |||
16 | With reasonably sized vmalloc area, PMD_SIZE shouldn't be a problem | ||
17 | but x86_32 at this point is anything but reasonable in terms of | ||
18 | address space and using larger atom_size reportedly leads to frequent | ||
19 | percpu allocation failures on certain setups. | ||
20 | |||
21 | As there is no reason to not use PMD_SIZE on x86_64 as vmalloc space | ||
22 | is aplenty and most x86_64 configurations support PSE, fix the issue | ||
23 | by always using PMD_SIZE on x86_64 and PAGE_SIZE on x86_32. | ||
24 | |||
25 | v2: drop cpu_has_pse test and make x86_64 always use PMD_SIZE and | ||
26 | x86_32 PAGE_SIZE as suggested by hpa. | ||
27 | |||
28 | Signed-off-by: Tejun Heo <tj@kernel.org> | ||
29 | Reported-by: Yanmin Zhang <yanmin.zhang@intel.com> | ||
30 | Reported-by: ShuoX Liu <shuox.liu@intel.com> | ||
31 | Acked-by: H. Peter Anvin <hpa@zytor.com> | ||
32 | LKML-Reference: <4F97BA98.6010001@intel.com> | ||
33 | Signed-off-by: Ben Hutchings <ben@decadent.org.uk> | ||
34 | --- | ||
35 | arch/x86/kernel/setup_percpu.c | 14 +++++++++++++- | ||
36 | 1 files changed, 13 insertions(+), 1 deletions(-) | ||
37 | |||
38 | diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c | ||
39 | index 71f4727..5a98aa2 100644 | ||
40 | --- a/arch/x86/kernel/setup_percpu.c | ||
41 | +++ b/arch/x86/kernel/setup_percpu.c | ||
42 | @@ -185,10 +185,22 @@ void __init setup_per_cpu_areas(void) | ||
43 | #endif | ||
44 | rc = -EINVAL; | ||
45 | if (pcpu_chosen_fc != PCPU_FC_PAGE) { | ||
46 | - const size_t atom_size = cpu_has_pse ? PMD_SIZE : PAGE_SIZE; | ||
47 | const size_t dyn_size = PERCPU_MODULE_RESERVE + | ||
48 | PERCPU_DYNAMIC_RESERVE - PERCPU_FIRST_CHUNK_RESERVE; | ||
49 | + size_t atom_size; | ||
50 | |||
51 | + /* | ||
52 | + * On 64bit, use PMD_SIZE for atom_size so that embedded | ||
53 | + * percpu areas are aligned to PMD. This, in the future, | ||
54 | + * can also allow using PMD mappings in vmalloc area. Use | ||
55 | + * PAGE_SIZE on 32bit as vmalloc space is highly contended | ||
56 | + * and large vmalloc area allocs can easily fail. | ||
57 | + */ | ||
58 | +#ifdef CONFIG_X86_64 | ||
59 | + atom_size = PMD_SIZE; | ||
60 | +#else | ||
61 | + atom_size = PAGE_SIZE; | ||
62 | +#endif | ||
63 | rc = pcpu_embed_first_chunk(PERCPU_FIRST_CHUNK_RESERVE, | ||
64 | dyn_size, atom_size, | ||
65 | pcpu_cpu_distance, | ||
66 | -- | ||
67 | 1.7.7.6 | ||
68 | |||