summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.17/0157-percpu-x86-don-t-use-PMD_SIZE-as-embedded-atom_size-.patch
diff options
context:
space:
mode:
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-.patch68
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 @@
1From 40bfc308a453997d543e78d6c825275710c48a1c Mon Sep 17 00:00:00 2001
2From: Tejun Heo <tj@kernel.org>
3Date: Fri, 27 Apr 2012 10:54:35 -0700
4Subject: [PATCH 157/165] percpu, x86: don't use PMD_SIZE as embedded
5 atom_size on 32bit
6
7commit d5e28005a1d2e67833852f4c9ea8ec206ea3ff85 upstream.
8
9With the embed percpu first chunk allocator, x86 uses either PAGE_SIZE
10or PMD_SIZE for atom_size. PMD_SIZE is used when CPU supports PSE so
11that percpu areas are aligned to PMD mappings and possibly allow using
12PMD mappings in vmalloc areas in the future. Using larger atom_size
13doesn't waste actual memory; however, it does require larger vmalloc
14space allocation later on for !first chunks.
15
16With reasonably sized vmalloc area, PMD_SIZE shouldn't be a problem
17but x86_32 at this point is anything but reasonable in terms of
18address space and using larger atom_size reportedly leads to frequent
19percpu allocation failures on certain setups.
20
21As there is no reason to not use PMD_SIZE on x86_64 as vmalloc space
22is aplenty and most x86_64 configurations support PSE, fix the issue
23by always using PMD_SIZE on x86_64 and PAGE_SIZE on x86_32.
24
25v2: drop cpu_has_pse test and make x86_64 always use PMD_SIZE and
26 x86_32 PAGE_SIZE as suggested by hpa.
27
28Signed-off-by: Tejun Heo <tj@kernel.org>
29Reported-by: Yanmin Zhang <yanmin.zhang@intel.com>
30Reported-by: ShuoX Liu <shuox.liu@intel.com>
31Acked-by: H. Peter Anvin <hpa@zytor.com>
32LKML-Reference: <4F97BA98.6010001@intel.com>
33Signed-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
38diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
39index 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--
671.7.7.6
68