]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.16.7/sparc64-kill-unnecessary-tables-and-increase-max_banks.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.16.7 / sparc64-kill-unnecessary-tables-and-increase-max_banks.patch
1 From foo@baz Tue Oct 28 11:19:22 CST 2014
2 From: "David S. Miller" <davem@davemloft.net>
3 Date: Sat, 27 Sep 2014 21:30:57 -0700
4 Subject: sparc64: Kill unnecessary tables and increase MAX_BANKS.
5
6 From: "David S. Miller" <davem@davemloft.net>
7
8 [ Upstream commit d195b71bad4347d2df51072a537f922546a904f1 ]
9
10 swapper_low_pmd_dir and swapper_pud_dir are actually completely
11 useless and unnecessary.
12
13 We just need swapper_pg_dir[]. Naturally the other page table chunks
14 will be allocated on an as-needed basis. Since the kernel actually
15 accesses these tables in the PAGE_OFFSET view, there is not even a TLB
16 locality advantage of placing them in the kernel image.
17
18 Use the hard coded vmlinux.ld.S slot for swapper_pg_dir which is
19 naturally page aligned.
20
21 Increase MAX_BANKS to 1024 in order to handle heavily fragmented
22 virtual guests.
23
24 Even with this MAX_BANKS increase, the kernel is 20K+ smaller.
25
26 Signed-off-by: David S. Miller <davem@davemloft.net>
27 Acked-by: Bob Picco <bob.picco@oracle.com>
28 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29 ---
30 arch/sparc/include/asm/pgtable_64.h | 1 -
31 arch/sparc/kernel/vmlinux.lds.S | 5 +++--
32 arch/sparc/mm/init_64.c | 25 ++-----------------------
33 3 files changed, 5 insertions(+), 26 deletions(-)
34
35 --- a/arch/sparc/include/asm/pgtable_64.h
36 +++ b/arch/sparc/include/asm/pgtable_64.h
37 @@ -927,7 +927,6 @@ static inline void __set_pte_at(struct m
38 #endif
39
40 extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
41 -extern pmd_t swapper_low_pmd_dir[PTRS_PER_PMD];
42
43 void paging_init(void);
44 unsigned long find_ecache_flush_span(unsigned long size);
45 --- a/arch/sparc/kernel/vmlinux.lds.S
46 +++ b/arch/sparc/kernel/vmlinux.lds.S
47 @@ -35,8 +35,9 @@ jiffies = jiffies_64;
48
49 SECTIONS
50 {
51 - /* swapper_low_pmd_dir is sparc64 only */
52 - swapper_low_pmd_dir = 0x0000000000402000;
53 +#ifdef CONFIG_SPARC64
54 + swapper_pg_dir = 0x0000000000402000;
55 +#endif
56 . = INITIAL_ADDRESS;
57 .text TEXTSTART :
58 {
59 --- a/arch/sparc/mm/init_64.c
60 +++ b/arch/sparc/mm/init_64.c
61 @@ -86,7 +86,7 @@ extern struct tsb swapper_tsb[KERNEL_TSB
62
63 static unsigned long cpu_pgsz_mask;
64
65 -#define MAX_BANKS 32
66 +#define MAX_BANKS 1024
67
68 static struct linux_prom64_registers pavail[MAX_BANKS];
69 static int pavail_ents;
70 @@ -1942,12 +1942,6 @@ static void __init sun4v_linear_pte_xor_
71
72 static unsigned long last_valid_pfn;
73
74 -/* These must be page aligned in order to not trigger the
75 - * alignment tests of pgd_bad() and pud_bad().
76 - */
77 -pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__ ((aligned (PAGE_SIZE)));
78 -static pud_t swapper_pud_dir[PTRS_PER_PUD] __attribute__ ((aligned (PAGE_SIZE)));
79 -
80 static void sun4u_pgprot_init(void);
81 static void sun4v_pgprot_init(void);
82
83 @@ -1955,8 +1949,6 @@ void __init paging_init(void)
84 {
85 unsigned long end_pfn, shift, phys_base;
86 unsigned long real_end, i;
87 - pud_t *pud;
88 - pmd_t *pmd;
89 int node;
90
91 setup_page_offset();
92 @@ -2051,20 +2043,7 @@ void __init paging_init(void)
93 */
94 init_mm.pgd += ((shift) / (sizeof(pgd_t)));
95
96 - memset(swapper_low_pmd_dir, 0, sizeof(swapper_low_pmd_dir));
97 -
98 - /* The kernel page tables we publish into what the rest of the
99 - * world sees must be adjusted so that they see the PAGE_OFFSET
100 - * address of these in-kerenel data structures. However right
101 - * here we must access them from the kernel image side, because
102 - * the trap tables haven't been taken over and therefore we cannot
103 - * take TLB misses in the PAGE_OFFSET linear mappings yet.
104 - */
105 - pud = swapper_pud_dir + (shift / sizeof(pud_t));
106 - pgd_set(&swapper_pg_dir[0], pud);
107 -
108 - pmd = swapper_low_pmd_dir + (shift / sizeof(pmd_t));
109 - pud_set(&swapper_pud_dir[0], pmd);
110 + memset(swapper_pg_dir, 0, sizeof(swapper_pg_dir));
111
112 inherit_prom_mappings();
113