public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Mel Gorman <mel@csn.ul.ie>
Cc: Adrian Bunk <bunk@kernel.org>,
	torvalds@linux-foundation.org, linux-kernel@vger.kernel.org,
	apw@shadowen.org
Subject: Re: [2.6 patch] fix mm/mm_init.c compilation
Date: Tue, 5 Aug 2008 02:11:41 -0700	[thread overview]
Message-ID: <20080805021141.0b060e04.akpm@linux-foundation.org> (raw)
In-Reply-To: <20080805075122.GA20243@csn.ul.ie>

On Tue, 5 Aug 2008 08:51:23 +0100 Mel Gorman <mel@csn.ul.ie> wrote:

> > > --- a/mm/mm_init.c
> > > +++ b/mm/mm_init.c
> > > @@ -63,6 +63,13 @@ void __init mminit_verify_pageflags_layout(void)
> > >  {
> > >  	int shift, width;
> > >  	unsigned long or_mask, add_mask;
> > > +	int sections_shift;
> > > +
> > > +#ifdef SECTIONS_SHIFT
> > > +	sections_shift = SECTIONS_SHIFT;
> > > +#else
> > > +	sections_shift = 0;
> > > +#endif
> > >  
> > >  	shift = 8 * sizeof(unsigned long);
> > >  	width = shift - SECTIONS_WIDTH - NODES_WIDTH - ZONES_WIDTH;
> > > @@ -74,11 +81,7 @@ void __init mminit_verify_pageflags_layout(void)
> > >  		NR_PAGEFLAGS);
> > >  	mminit_dprintk(MMINIT_TRACE, "pageflags_layout_shifts",
> > >  		"Section %d Node %d Zone %d\n",
> > > -#ifdef SECTIONS_SHIFT
> > > -		SECTIONS_SHIFT,
> > > -#else
> > > -		0,
> > > -#endif
> > > +		sections_shift,
> > >  		NODES_SHIFT,
> > >  		ZONES_SHIFT);
> > >  	mminit_dprintk(MMINIT_TRACE, "pageflags_layout_offsets",
> > 
> > OK, ifdefs inside macro expansion aren't a great idea.
> > 
> > Mel, is there any erason why we shouldn't do it this way?
> > 
> 
> The only minor nit is SECTIONS_SHIFT is defined outside of SPARSEMEM even
> though it has no meaning there. There is no problem with this as such but
> someone being silly might use SECTIONS_SHIFT accidently. If this sort of
> behaviour was considered a possibility, we could add something like this to
> mm/mm_init.c instead?

That sounds sane.

diff -puN mm/mm_init.c~mm_initc-avoid-ifdef-inside-macro-expansion mm/mm_init.c
--- a/mm/mm_init.c~mm_initc-avoid-ifdef-inside-macro-expansion
+++ a/mm/mm_init.c
@@ -14,6 +14,10 @@
 #ifdef CONFIG_DEBUG_MEMORY_INIT
 int __meminitdata mminit_loglevel;
 
+#ifndef SECTIONS_SHIFT
+#define SECTIONS_SHIFT	0
+#endif
+
 /* The zonelists are simply reported, validation is manual. */
 void mminit_verify_zonelist(void)
 {
@@ -74,11 +78,7 @@ void __init mminit_verify_pageflags_layo
 		NR_PAGEFLAGS);
 	mminit_dprintk(MMINIT_TRACE, "pageflags_layout_shifts",
 		"Section %d Node %d Zone %d\n",
-#ifdef SECTIONS_SHIFT
 		SECTIONS_SHIFT,
-#else
-		0,
-#endif
 		NODES_SHIFT,
 		ZONES_SHIFT);
 	mminit_dprintk(MMINIT_TRACE, "pageflags_layout_offsets",
_


      reply	other threads:[~2008-08-05  9:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-04 18:19 [2.6 patch] fix mm/mm_init.c compilation Adrian Bunk
2008-08-04 21:05 ` Andrew Morton
2008-08-05  7:51   ` Mel Gorman
2008-08-05  9:11     ` Andrew Morton [this message]

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=20080805021141.0b060e04.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=apw@shadowen.org \
    --cc=bunk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mel@csn.ul.ie \
    --cc=torvalds@linux-foundation.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox