aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRasmus Villemoes <linux@rasmusvillemoes.dk>2015-05-14 01:01:38 +0000
committerJohannes Weiner <hannes@cmpxchg.org>2015-05-14 01:01:38 +0000
commit83be29b21882dd6c449dbf0e1f23135e482d1df7 (patch)
treed659117bf2855939929279756bace3e4d253157d
parent6af2c7bafad4d2db3cb9f8f211b77fd497fa1166 (diff)
downloadmm-next-83be29b21882dd6c449dbf0e1f23135e482d1df7.tar.gz
mm: only define hashdist variable when needed
For !CONFIG_NUMA, hashdist will always be 0, since it's setter is otherwise compiled out. So we can save 4 bytes of data and some .text (although mostly in __init functions) by only defining it for CONFIG_NUMA. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Acked-by: David Rientjes <rientjes@google.com> Reviewed-by: Michal Hocko <mhocko@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--include/linux/bootmem.h8
-rw-r--r--mm/page_alloc.c2
2 files changed, 5 insertions, 5 deletions
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 0995c2de8162c2..f589222bfa87e4 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -357,12 +357,12 @@ extern void *alloc_large_system_hash(const char *tablename,
/* Only NUMA needs hash distribution. 64bit NUMA architectures have
* sufficient vmalloc space.
*/
-#if defined(CONFIG_NUMA) && defined(CONFIG_64BIT)
-#define HASHDIST_DEFAULT 1
+#ifdef CONFIG_NUMA
+#define HASHDIST_DEFAULT IS_ENABLED(CONFIG_64BIT)
+extern int hashdist; /* Distribute hashes across NUMA nodes? */
#else
-#define HASHDIST_DEFAULT 0
+#define hashdist (0)
#endif
-extern int hashdist; /* Distribute hashes across NUMA nodes? */
#endif /* _LINUX_BOOTMEM_H */
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index d358ab52edbfa4..efcce7639fd44a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6345,9 +6345,9 @@ out:
return ret;
}
+#ifdef CONFIG_NUMA
int hashdist = HASHDIST_DEFAULT;
-#ifdef CONFIG_NUMA
static int __init set_hashdist(char *str)
{
if (!str)