]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.31/patches.arch/ppc64-reduce-hashtable-size-for-64k-pages.patch
Move xen patchset to new version's subdir.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.arch / ppc64-reduce-hashtable-size-for-64k-pages.patch
CommitLineData
00e5a55c
BS
1From: Anton Blanchard <anton@samba.org>
2Subject: powerpc/mm: Reduce hashtable size when using 64kB pages
3Date: Fri Feb 13 11:57:30 2009 +0000
4References: bnc#501160
5Patch-upstream: yes
6Git: 13870b657578bcce167978ee93dc02bf54e3beb0
7
8 powerpc/mm: Reduce hashtable size when using 64kB pages
9
10 At the moment we size the hashtable based on 4kB pages / 2, even on a
11 64kB kernel. This results in a hashtable that is much larger than it
12 needs to be.
13
14 Grab the real page size and size the hashtable based on that
15
16 Note: This only has effect on non hypervisor machines.
17
18 Signed-off-by: Anton Blanchard <anton@samba.org>
19 Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
20Acked-by: Nick Piggin <npiggin@suse.de>
21
22diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
23index 8d5b475..f5bc1b2 100644
24--- a/arch/powerpc/mm/hash_utils_64.c
25+++ b/arch/powerpc/mm/hash_utils_64.c
26@@ -516,7 +516,7 @@ static int __init htab_dt_scan_pftsize(unsigned long node,
27
28 static unsigned long __init htab_get_table_size(void)
29 {
30- unsigned long mem_size, rnd_mem_size, pteg_count;
31+ unsigned long mem_size, rnd_mem_size, pteg_count, psize;
32
33 /* If hash size isn't already provided by the platform, we try to
34 * retrieve it from the device-tree. If it's not there neither, we
35@@ -534,7 +534,8 @@ static unsigned long __init htab_get_table_size(void)
36 rnd_mem_size <<= 1;
37
38 /* # pages / 2 */
39- pteg_count = max(rnd_mem_size >> (12 + 1), 1UL << 11);
40+ psize = mmu_psize_defs[mmu_virtual_psize].shift;
41+ pteg_count = max(rnd_mem_size >> (psize + 1), 1UL << 11);
42
43 return pteg_count << 7;
44 }