Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1186814

Re: [PATCH 3/3] mm, meminit: Allow early_pfn_to_nid to be used during runtime

From Mel Gorman <mgorman@suse.de>
Newsgroups linux.kernel
Subject Re: [PATCH 3/3] mm, meminit: Allow early_pfn_to_nid to be used during runtime
Date 2015-07-17 15:20 +0200
Message-ID <pNdIu-6vu-27@gated-at.bofh.it> (permalink)
References <pNcW6-5lc-7@gated-at.bofh.it> <pNcW6-5lc-13@gated-at.bofh.it> <pNdIv-6vu-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Jul 17, 2015 at 03:12:32PM +0200, Peter Zijlstra wrote:
> On Fri, Jul 17, 2015 at 01:22:04PM +0100, Mel Gorman wrote:
> >  int __meminit early_pfn_to_nid(unsigned long pfn)
> >  {
> > +	static DEFINE_SPINLOCK(early_pfn_lock);
> >  	int nid;
> >  
> > -	/* The system will behave unpredictably otherwise */
> > -	BUG_ON(system_state != SYSTEM_BOOTING);
> > +	/* Avoid locking overhead during boot but hotplug must lock */
> > +	if (system_state != SYSTEM_BOOTING)
> > +		spin_lock(&early_pfn_lock);
> >  
> >  	nid = __early_pfn_to_nid(pfn, &early_pfnnid_cache);
> > -	if (nid >= 0)
> > -		return nid;
> > -	/* just returns 0 */
> > -	return 0;
> > +	if (nid < 0)
> > +		nid = 0;
> > +
> > +	if (system_state != SYSTEM_BOOTING)
> > +		spin_unlock(&early_pfn_lock);
> > +
> > +	return nid;
> >  }
> 
> Why the conditional locking?

Unnecessary during boot when it's inherently serialised. The point of
the deferred initialisation was to boot as quickly as possible.

-- 
Mel Gorman
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3/3] mm, meminit: Allow early_pfn_to_nid to be used during runtime Mel Gorman <mgorman@suse.de> - 2015-07-17 14:30 +0200
  Re: [PATCH 3/3] mm, meminit: Allow early_pfn_to_nid to be used  during runtime Mel Gorman <mgorman@suse.de> - 2015-07-17 15:20 +0200
    Re: [PATCH 3/3] mm, meminit: Allow early_pfn_to_nid to be used  during runtime Peter Zijlstra <peterz@infradead.org> - 2015-07-17 15:30 +0200
      Re: [PATCH 3/3] mm, meminit: Allow early_pfn_to_nid to be used  during runtime Mel Gorman <mgorman@suse.de> - 2015-07-17 15:40 +0200
        Re: [PATCH 3/3] mm, meminit: Allow early_pfn_to_nid to be used  during runtime Peter Zijlstra <peterz@infradead.org> - 2015-07-17 16:00 +0200
  Re: [PATCH 3/3] mm, meminit: Allow early_pfn_to_nid to be used  during runtime Peter Zijlstra <peterz@infradead.org> - 2015-07-17 15:20 +0200

csiph-web