public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Mel Gorman <mel@csn.ul.ie>
Subject: Re: [PATCH] x86: set_highmem_pages_init() cleanup
Date: Wed, 4 Mar 2009 18:59:44 +0100	[thread overview]
Message-ID: <20090304175944.GA1537@elte.hu> (raw)
In-Reply-To: <1236154567.29024.23.camel@penberg-laptop>


* Pekka Enberg <penberg@cs.helsinki.fi> wrote:

> On Tue, 2009-03-03 at 13:15 +0100, Ingo Molnar wrote:
> > * Pekka Enberg <penberg@cs.helsinki.fi> wrote:
> > 
> > > From: Pekka Enberg <penberg@cs.helsinki.fi>
> > > 
> > > Impact: cleanup
> > > 
> > > This patch moves set_highmem_pages_init() to arch/x86/mm/highmem_32.c. The
> > > declaration of the function is kept in asm/numa_32.h because asm/highmem.h is
> > > included only CONFIG_HIGHMEM is enabled so we can't put the empty static inline
> > > function there.
> > > 
> > > Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
> > > ---
> > >  arch/x86/include/asm/numa_32.h |    6 +++++-
> > >  arch/x86/mm/highmem_32.c       |   34 ++++++++++++++++++++++++++++++++++
> > >  arch/x86/mm/init_32.c          |   12 ------------
> > >  arch/x86/mm/numa_32.c          |   26 --------------------------
> > >  4 files changed, 39 insertions(+), 39 deletions(-)
> > 
> > Applied, thanks!
> > 
> > One question:
> > 
> > > diff --git a/arch/x86/include/asm/numa_32.h b/arch/x86/include/asm/numa_32.h
> > > index e9f5db7..a372290 100644
> > > --- a/arch/x86/include/asm/numa_32.h
> > > +++ b/arch/x86/include/asm/numa_32.h
> > > @@ -4,8 +4,12 @@
> > >  extern int pxm_to_nid(int pxm);
> > >  extern void numa_remove_cpu(int cpu);
> > >  
> > > -#ifdef CONFIG_NUMA
> > > +#ifdef CONFIG_HIGHMEM
> > >  extern void set_highmem_pages_init(void);
> > > +#else
> > > +static inline void set_highmem_pages_init(void)
> > > +{
> > > +}
> > >  #endif
> > >  
> > >  #endif /* _ASM_X86_NUMA_32_H */
> > > diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c
> > > index bcc079c..13a823c 100644
> > > --- a/arch/x86/mm/highmem_32.c
> > > +++ b/arch/x86/mm/highmem_32.c
> > > @@ -1,5 +1,6 @@
> > >  #include <linux/highmem.h>
> > >  #include <linux/module.h>
> > > +#include <linux/swap.h> /* for totalram_pages */
> > >  
> > >  void *kmap(struct page *page)
> > >  {
> > > @@ -156,3 +157,36 @@ EXPORT_SYMBOL(kmap);
> > >  EXPORT_SYMBOL(kunmap);
> > >  EXPORT_SYMBOL(kmap_atomic);
> > >  EXPORT_SYMBOL(kunmap_atomic);
> > > +
> > > +#ifdef CONFIG_NUMA
> > > +void __init set_highmem_pages_init(void)
> > > +{
> > > +	struct zone *zone;
> > > +	int nid;
> > > +
> > > +	for_each_zone(zone) {
> > > +		unsigned long zone_start_pfn, zone_end_pfn;
> > > +
> > > +		if (!is_highmem(zone))
> > > +			continue;
> > > +
> > > +		zone_start_pfn = zone->zone_start_pfn;
> > > +		zone_end_pfn = zone_start_pfn + zone->spanned_pages;
> > > +
> > > +		nid = zone_to_nid(zone);
> > > +		printk(KERN_INFO "Initializing %s for node %d (%08lx:%08lx)\n",
> > > +				zone->name, nid, zone_start_pfn, zone_end_pfn);
> > > +
> > > +		add_highpages_with_active_regions(nid, zone_start_pfn,
> > > +				 zone_end_pfn);
> > > +	}
> > > +	totalram_pages += totalhigh_pages;
> > > +}
> > > +#else
> > > +static void __init set_highmem_pages_init(void)
> > > +{
> > > +	add_highpages_with_active_regions(0, highstart_pfn, highend_pfn);
> > > +
> > > +	totalram_pages += totalhigh_pages;
> > > +}
> > > +#endif /* CONFIG_NUMA */
> > 
> > Couldnt we just wrap the !NUMA case into the NUMA case and just 
> > have the NUMA function present, by making for_each_zone() a 
> > two-entries matter and making the second entry contain:
> > 
> >    zone->zone_start_pfn := highstart_pfn
> >    zone->spanned_pages := highend_pfn-highstart_pfn 
> 
> OK, I don't quite understand your suggestion here. The zones 
> are set up completely at this stage so AFAICT, even for the 
> UMA case, there should be a highmem zone there. So unless I am 
> missing something here, I think we can get away with something 
> as simple as the following.

ok, good - it is an easier cleanup than i hoped it would be :-)

	Ingo

  reply	other threads:[~2009-03-04 18:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-03 12:10 [PATCH] x86: set_highmem_pages_init() cleanup Pekka Enberg
2009-03-03 12:15 ` Ingo Molnar
2009-03-04  8:16   ` Pekka Enberg
2009-03-04 17:59     ` Ingo Molnar [this message]
2009-03-04 18:01       ` Ingo Molnar
2009-03-04 19:21     ` [tip:x86/mm] x86: set_highmem_pages_init() cleanup, #2 Pekka Enberg
2009-03-03 12:15 ` [tip:x86/mm] x86: set_highmem_pages_init() cleanup Pekka Enberg
2009-03-03 14:36 ` [tip:x86/mm] x86: set_highmem_pages_init() cleanup, fix !CONFIG_NUMA && CONFIG_HIGHMEM=y Ingo Molnar
2009-03-03 19:17   ` Pekka Enberg

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=20090304175944.GA1537@elte.hu \
    --to=mingo@elte.hu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mel@csn.ul.ie \
    --cc=penberg@cs.helsinki.fi \
    --cc=x86@kernel.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