From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751950AbbEFLMt (ORCPT ); Wed, 6 May 2015 07:12:49 -0400 Received: from cantor2.suse.de ([195.135.220.15]:50043 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751329AbbEFLMr (ORCPT ); Wed, 6 May 2015 07:12:47 -0400 Date: Wed, 6 May 2015 13:12:45 +0200 From: Michal Hocko To: Rasmus Villemoes Cc: Andrew Morton , Joonsoo Kim , David Rientjes , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] mm: only define hashdist variable when needed Message-ID: <20150506111245.GG14550@dhcp22.suse.cz> References: <1430753249-30850-1-git-send-email-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1430753249-30850-1-git-send-email-linux@rasmusvillemoes.dk> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Michal Hocko > --- > 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