* [PATCH] mm: only define hashdist variable when needed
@ 2015-05-04 15:27 Rasmus Villemoes
2015-05-06 11:12 ` Michal Hocko
2015-05-06 19:50 ` David Rientjes
0 siblings, 2 replies; 3+ messages in thread
From: Rasmus Villemoes @ 2015-05-04 15:27 UTC (permalink / raw)
To: Andrew Morton, Joonsoo Kim, Michal Hocko, David Rientjes
Cc: Rasmus Villemoes, linux-kernel, linux-mm
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>
---
include/linux/bootmem.h | 8 ++++----
mm/page_alloc.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 0995c2de8162..f589222bfa87 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 ebffa0e4a9c0..159dbbc3375d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6013,9 +6013,9 @@ out:
return ret;
}
+#ifdef CONFIG_NUMA
int hashdist = HASHDIST_DEFAULT;
-#ifdef CONFIG_NUMA
static int __init set_hashdist(char *str)
{
if (!str)
--
2.1.3
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] mm: only define hashdist variable when needed
2015-05-04 15:27 [PATCH] mm: only define hashdist variable when needed Rasmus Villemoes
@ 2015-05-06 11:12 ` Michal Hocko
2015-05-06 19:50 ` David Rientjes
1 sibling, 0 replies; 3+ messages in thread
From: Michal Hocko @ 2015-05-06 11:12 UTC (permalink / raw)
To: Rasmus Villemoes
Cc: Andrew Morton, Joonsoo Kim, David Rientjes, linux-kernel, linux-mm
On Mon 04-05-15 17:27:29, Rasmus Villemoes wrote:
> 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>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
> ---
> include/linux/bootmem.h | 8 ++++----
> mm/page_alloc.c | 2 +-
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
> index 0995c2de8162..f589222bfa87 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 ebffa0e4a9c0..159dbbc3375d 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -6013,9 +6013,9 @@ out:
> return ret;
> }
>
> +#ifdef CONFIG_NUMA
> int hashdist = HASHDIST_DEFAULT;
>
> -#ifdef CONFIG_NUMA
> static int __init set_hashdist(char *str)
> {
> if (!str)
> --
> 2.1.3
>
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] mm: only define hashdist variable when needed
2015-05-04 15:27 [PATCH] mm: only define hashdist variable when needed Rasmus Villemoes
2015-05-06 11:12 ` Michal Hocko
@ 2015-05-06 19:50 ` David Rientjes
1 sibling, 0 replies; 3+ messages in thread
From: David Rientjes @ 2015-05-06 19:50 UTC (permalink / raw)
To: Rasmus Villemoes
Cc: Andrew Morton, Joonsoo Kim, Michal Hocko, linux-kernel, linux-mm
On Mon, 4 May 2015, Rasmus Villemoes wrote:
> 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>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-05-06 19:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-04 15:27 [PATCH] mm: only define hashdist variable when needed Rasmus Villemoes
2015-05-06 11:12 ` Michal Hocko
2015-05-06 19:50 ` David Rientjes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox