diff options
author | Pavel Tatashin <pasha.tatashin@oracle.com> | 2017-05-26 11:31:53 +1000 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2017-05-26 11:31:53 +1000 |
commit | 706e1708b22f9e1dd28f7205d86376ae39b0aa26 (patch) | |
tree | 0921911c1a104fb94871fc074036ed6e78378b04 /mm | |
parent | c2f258b4d5032a4d1c72494ba9d750ca16acc982 (diff) |
mm-adaptive-hash-table-scaling-v5
Disable adaptive hash on 32 bit systems to avoid confusion of whether base
should be different for smaller systems, and to avoid overflows.
Link: http://lkml.kernel.org/r/1495469329-755807-2-git-send-email-pasha.tatashin@oracle.com
Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
Cc: David Miller <davem@davemloft.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Babu Moger <babu.moger@oracle.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/page_alloc.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 10de4d84e37b..aef8e02cf37f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7174,10 +7174,14 @@ static unsigned long __init arch_reserved_kernel_pages(void) * slower pace. Starting from ADAPT_SCALE_BASE (64G), every time memory * quadruples the scale is increased by one, which means the size of hash table * only doubles, instead of quadrupling as well. + * Because 32-bit systems cannot have large physical memory, where this scaling + * makes sense, it is disabled on such platforms. */ -#define ADAPT_SCALE_BASE (64ull << 30) +#if __BITS_PER_LONG > 32 +#define ADAPT_SCALE_BASE (64ul << 30) #define ADAPT_SCALE_SHIFT 2 #define ADAPT_SCALE_NPAGES (ADAPT_SCALE_BASE >> PAGE_SHIFT) +#endif /* * allocate a large system hash table from bootmem @@ -7210,13 +7214,15 @@ void *__init alloc_large_system_hash(const char *tablename, if (PAGE_SHIFT < 20) numentries = round_up(numentries, (1<<20)/PAGE_SIZE); +#if __BITS_PER_LONG > 32 if (!high_limit) { - unsigned long long adapt; + unsigned long adapt; for (adapt = ADAPT_SCALE_NPAGES; adapt < numentries; adapt <<= ADAPT_SCALE_SHIFT) scale++; } +#endif /* limit to 1 bucket per 2^scale bytes of low memory */ if (scale > PAGE_SHIFT) |