All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: David Rientjes <rientjes@google.com>
Cc: Randy Dunlap <rdunlap@xenotime.net>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
	Richard Weinberger <richard@nod.at>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: Re: inux-next: Tree for Apr 27 (uml + mm/memcontrol.c)
Date: Fri, 27 Apr 2012 13:23:43 -0700	[thread overview]
Message-ID: <20120427132343.fbb443b9.akpm@linux-foundation.org> (raw)
In-Reply-To: <alpine.DEB.2.00.1204271141040.28516@chino.kir.corp.google.com>

On Fri, 27 Apr 2012 11:44:24 -0700 (PDT)
David Rientjes <rientjes@google.com> wrote:

> On Fri, 27 Apr 2012, Randy Dunlap wrote:
> 
> > On 04/26/2012 11:11 PM, Stephen Rothwell wrote:
> > 
> > > Hi all,
> > > 
> > > Changes since 20120424:
> > 
> > 
> > 
> > uml on x86_64 (defconfig):
> > 
> > mm/memcontrol.c:256:30: error: 'HUGE_MAX_HSTATE' undeclared here (not in a function)
> > 
> 
> This is because of "memcg: add HugeTLB extension" from -mm.
> 
> This patch is legal in C99, I wonder if Andrew would let us get away with 
> something like this so there's no a dozen #ifdefs in mm/memcontrol.c?
> ---
> diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
> --- a/arch/powerpc/include/asm/page.h
> +++ b/arch/powerpc/include/asm/page.h
> @@ -39,13 +39,13 @@
>  #ifndef __ASSEMBLY__
>  #ifdef CONFIG_HUGETLB_PAGE
>  extern unsigned int HPAGE_SHIFT;
> +#define HUGE_MAX_HSTATE		(MMU_PAGE_COUNT-1)
>  #else
>  #define HPAGE_SHIFT PAGE_SHIFT
>  #endif
>  #define HPAGE_SIZE		((1UL) << HPAGE_SHIFT)
>  #define HPAGE_MASK		(~(HPAGE_SIZE - 1))
>  #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT)
> -#define HUGE_MAX_HSTATE		(MMU_PAGE_COUNT-1)
>  #endif
>  
>  /* We do define AT_SYSINFO_EHDR but don't use the gate mechanism */
> diff --git a/arch/tile/include/asm/page.h b/arch/tile/include/asm/page.h
> --- a/arch/tile/include/asm/page.h
> +++ b/arch/tile/include/asm/page.h
> @@ -136,9 +136,8 @@ static inline __attribute_const__ int get_order(unsigned long size)
>  
>  #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT)
>  
> -#define HUGE_MAX_HSTATE		6
> -
>  #ifdef CONFIG_HUGETLB_PAGE
> +#define HUGE_MAX_HSTATE		6
>  #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
>  #endif
>  
> diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h
> --- a/arch/x86/include/asm/page_types.h
> +++ b/arch/x86/include/asm/page_types.h
> @@ -25,7 +25,9 @@
>  #define HPAGE_MASK		(~(HPAGE_SIZE - 1))
>  #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT)
>  
> +#ifdef CONFIG_HUGETLB_PAGE
>  #define HUGE_MAX_HSTATE 2
> +#endif
>  
>  #define PAGE_OFFSET		((unsigned long)__PAGE_OFFSET)
>  
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -324,6 +324,7 @@ static inline int hstate_index(struct hstate *h)
>  
>  #else
>  struct hstate {};
> +#define HUGE_MAX_HSTATE 0
>  #define alloc_huge_page_node(h, nid) NULL
>  #define alloc_bootmem_huge_page(h) NULL
>  #define hstate_file(f) NULL

Seems reasonable.  But the CONFIG_HUGETLB_PAGE=y,
CONFIG_MEM_RES_CTLR_HUGETLB=n combination will cause unneeded code
generation and space consumption in memcontrol.c.

I wonder if we can additionally do, within memcontrol.c:

/*
 * Nice comment goes here
 */
#ifdef CONFIG_MEM_RES_CTLR_HUGETLB
#define HUGE_MAX_HSTATE_FOO HUGE_MAX_HSTATE
#else
#define HUGE_MAX_HSTATE_FOO 0
#endif

and s/HUGE_MAX_HSTATE/HUGE_MAX_HSTATE_FOO/ in that file.

  reply	other threads:[~2012-04-27 20:23 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-27  6:11 inux-next: Tree for Apr 27 Stephen Rothwell
2012-04-27 15:47 ` inux-next: Tree for Apr 27 (uml + mm/memcontrol.c) Randy Dunlap
2012-04-27 18:44   ` David Rientjes
2012-04-27 20:23     ` Andrew Morton [this message]
2012-04-27 21:27       ` David Rientjes
2012-04-27 21:36         ` Andrew Morton
2012-04-27 23:14           ` David Rientjes
2012-04-27 23:24             ` Andrew Morton
2012-04-27 23:52               ` David Rientjes
2012-04-28 18:01           ` Aneesh Kumar K.V
2012-05-03  9:13             ` David Rientjes
2012-05-03 10:30               ` Hiroyuki Kamezawa
2012-05-03 20:56                 ` David Rientjes
2012-05-03 21:57                   ` David Rientjes
2012-05-03 23:21                     ` Hiroyuki Kamezawa
2012-05-03 23:33                       ` Hiroyuki Kamezawa
2012-05-04 18:29                     ` Aneesh Kumar K.V
2012-05-03 23:17                   ` Hiroyuki Kamezawa
2012-05-04 17:24                     ` Tejun Heo
2012-05-07 14:01                       ` Michal Hocko
2012-05-07 17:08                         ` Tejun Heo
2012-05-08 10:48                           ` Michal Hocko
2012-05-03 13:54               ` Aneesh Kumar K.V
2012-05-03 20:39                 ` David Rientjes
2012-04-28  0:45     ` Randy Dunlap
     [not found] ` <20120427161146.95422142968526faaff615d4-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org>
2012-04-27 16:56   ` inux-next: Tree for Apr 27 (infiniband/hw/ocrdma) Randy Dunlap
2012-04-27 16:56     ` Randy Dunlap
     [not found]     ` <4F9ACFC4.6010002-/UHa2rfvQTnk1uMJSBkQmQ@public.gmane.org>
2012-04-27 23:54       ` Roland Dreier
2012-04-27 23:54         ` Roland Dreier
2012-05-02 22:51     ` [PATCH] RDMA/ocrdma: Fix build with IPV6=n Roland Dreier
     [not found]       ` <1335999060-23779-1-git-send-email-roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2012-05-03  0:29         ` Randy Dunlap
2012-05-03  0:29           ` Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120427132343.fbb443b9.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    --cc=richard@nod.at \
    --cc=rientjes@google.com \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.