All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Gavin Shan <shangw@linux.vnet.ibm.com>,
	David Miller <davem@davemloft.net>,
	Yinghai Lu <yinghai@kernel.org>, Tejun Heo <tj@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [patch 10/10] mm: remove sparsemem allocation details from the bootmem allocator
Date: Tue, 15 May 2012 13:47:16 +0200	[thread overview]
Message-ID: <20120515114716.GI1406@cmpxchg.org> (raw)
In-Reply-To: <20120510144439.eba9c486.akpm@linux-foundation.org>

On Thu, May 10, 2012 at 02:44:39PM -0700, Andrew Morton wrote:
> On Mon,  7 May 2012 13:37:52 +0200
> Johannes Weiner <hannes@cmpxchg.org> wrote:
> 
> > alloc_bootmem_section() derives allocation area constraints from the
> > specified sparsemem section.  This is a bit specific for a generic
> > memory allocator like bootmem, though, so move it over to sparsemem.
> > 
> > As __alloc_bootmem_node_nopanic() already retries failed allocations
> > with relaxed area constraints, the fallback code in sparsemem.c can be
> > removed and the code becomes a bit more compact overall.
> > 
> > ...
> >
> > @@ -332,9 +334,9 @@ static void __init check_usemap_section_nr(int nid, unsigned long *usemap)
> >  #else
> >  static unsigned long * __init
> >  sparse_early_usemaps_alloc_pgdat_section(struct pglist_data *pgdat,
> > -					 unsigned long count)
> > +					 unsigned long size)
> >  {
> > -	return NULL;
> > +	return alloc_bootmem_node_nopanic(pgdat, size)
> 
> You've been bad.   Your penance is to runtime test this code with
> CONFIG_MEMORY_HOTREMOVE=n!

I did now.

See, but I DID test the =y case, missed an obvious bug and even
considered the particular node-section dependency warnings to be
expected in the setup configuration.  Testing is no way around being a
cretin :(

So here is another fix:

---
From: Johannes Weiner <hannes@cmpxchg.org>
Subject: [patch] mm: remove sparsemem allocation details from the bootmem
 allocator fix

Don't confuse an address with a pfn.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 mm/sparse.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/sparse.c b/mm/sparse.c
index 2192b67..66d1845 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -288,7 +288,7 @@ sparse_early_usemaps_alloc_pgdat_section(struct pglist_data *pgdat,
 	 * this problem.
 	 */
 	goal = __pa(pgdat) & PAGE_SECTION_MASK;
-	host_pgdat = NODE_DATA(early_pfn_to_nid(goal));
+	host_pgdat = NODE_DATA(early_pfn_to_nid(goal >> PAGE_SHIFT));
 	printk("allocating usemap for node %d on node %d (goal=%lu)\n",
 	       pgdat->node_id, host_pgdat->node_id, goal);
 	return __alloc_bootmem_node_nopanic(host_pgdat, size,
-- 
1.7.10.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Johannes Weiner <hannes@cmpxchg.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Gavin Shan <shangw@linux.vnet.ibm.com>,
	David Miller <davem@davemloft.net>,
	Yinghai Lu <yinghai@kernel.org>, Tejun Heo <tj@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [patch 10/10] mm: remove sparsemem allocation details from the bootmem allocator
Date: Tue, 15 May 2012 13:47:16 +0200	[thread overview]
Message-ID: <20120515114716.GI1406@cmpxchg.org> (raw)
In-Reply-To: <20120510144439.eba9c486.akpm@linux-foundation.org>

On Thu, May 10, 2012 at 02:44:39PM -0700, Andrew Morton wrote:
> On Mon,  7 May 2012 13:37:52 +0200
> Johannes Weiner <hannes@cmpxchg.org> wrote:
> 
> > alloc_bootmem_section() derives allocation area constraints from the
> > specified sparsemem section.  This is a bit specific for a generic
> > memory allocator like bootmem, though, so move it over to sparsemem.
> > 
> > As __alloc_bootmem_node_nopanic() already retries failed allocations
> > with relaxed area constraints, the fallback code in sparsemem.c can be
> > removed and the code becomes a bit more compact overall.
> > 
> > ...
> >
> > @@ -332,9 +334,9 @@ static void __init check_usemap_section_nr(int nid, unsigned long *usemap)
> >  #else
> >  static unsigned long * __init
> >  sparse_early_usemaps_alloc_pgdat_section(struct pglist_data *pgdat,
> > -					 unsigned long count)
> > +					 unsigned long size)
> >  {
> > -	return NULL;
> > +	return alloc_bootmem_node_nopanic(pgdat, size)
> 
> You've been bad.   Your penance is to runtime test this code with
> CONFIG_MEMORY_HOTREMOVE=n!

I did now.

See, but I DID test the =y case, missed an obvious bug and even
considered the particular node-section dependency warnings to be
expected in the setup configuration.  Testing is no way around being a
cretin :(

So here is another fix:

---
From: Johannes Weiner <hannes@cmpxchg.org>
Subject: [patch] mm: remove sparsemem allocation details from the bootmem
 allocator fix

Don't confuse an address with a pfn.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 mm/sparse.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/sparse.c b/mm/sparse.c
index 2192b67..66d1845 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -288,7 +288,7 @@ sparse_early_usemaps_alloc_pgdat_section(struct pglist_data *pgdat,
 	 * this problem.
 	 */
 	goal = __pa(pgdat) & PAGE_SECTION_MASK;
-	host_pgdat = NODE_DATA(early_pfn_to_nid(goal));
+	host_pgdat = NODE_DATA(early_pfn_to_nid(goal >> PAGE_SHIFT));
 	printk("allocating usemap for node %d on node %d (goal=%lu)\n",
 	       pgdat->node_id, host_pgdat->node_id, goal);
 	return __alloc_bootmem_node_nopanic(host_pgdat, size,
-- 
1.7.10.1


  reply	other threads:[~2012-05-15 11:47 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-07 11:37 [patch 00/10] (no)bootmem bits for 3.5 Johannes Weiner
2012-05-07 11:37 ` Johannes Weiner
2012-05-07 11:37 ` [patch 01/10] mm: bootmem: fix checking the bitmap when finally freeing bootmem Johannes Weiner
2012-05-07 11:37   ` Johannes Weiner
2012-05-07 18:07   ` Tejun Heo
2012-05-07 18:07     ` Tejun Heo
2012-05-07 11:37 ` [patch 02/10] mm: bootmem: remove redundant offset check " Johannes Weiner
2012-05-07 11:37   ` Johannes Weiner
2012-05-07 18:08   ` Tejun Heo
2012-05-07 18:08     ` Tejun Heo
2012-05-07 11:37 ` [patch 03/10] mm: bootmem: rename alloc_bootmem_core to alloc_bootmem_bdata Johannes Weiner
2012-05-07 11:37   ` Johannes Weiner
2012-05-07 11:37 ` [patch 04/10] mm: bootmem: split out goal-to-node mapping from goal dropping Johannes Weiner
2012-05-07 11:37   ` Johannes Weiner
2012-05-07 11:37 ` [patch 05/10] mm: bootmem: allocate in order node+goal, goal, node, anywhere Johannes Weiner
2012-05-07 11:37   ` Johannes Weiner
2012-05-07 11:37 ` [patch 06/10] mm: bootmem: unify allocation policy of (non-)panicking node allocations Johannes Weiner
2012-05-07 11:37   ` Johannes Weiner
2012-05-07 11:37 ` [patch 07/10] mm: nobootmem: panic on node-specific allocation failure Johannes Weiner
2012-05-07 11:37   ` Johannes Weiner
2012-05-07 19:17   ` Yinghai Lu
2012-05-07 19:17     ` Yinghai Lu
2012-05-07 11:37 ` [patch 08/10] mm: nobootmem: unify allocation policy of (non-)panicking node allocations Johannes Weiner
2012-05-07 11:37   ` Johannes Weiner
2012-05-07 19:23   ` Yinghai Lu
2012-05-07 19:23     ` Yinghai Lu
2012-05-07 11:37 ` [patch 09/10] mm: bootmem: pass pgdat instead of pgdat->bdata down the stack Johannes Weiner
2012-05-07 11:37   ` Johannes Weiner
2012-05-07 11:37 ` [patch 10/10] mm: remove sparsemem allocation details from the bootmem allocator Johannes Weiner
2012-05-07 11:37   ` Johannes Weiner
2012-05-07 18:19   ` Tejun Heo
2012-05-07 18:19     ` Tejun Heo
2012-05-07 18:21     ` David Miller
2012-05-07 18:21       ` David Miller
2012-05-10 21:44   ` Andrew Morton
2012-05-10 21:44     ` Andrew Morton
2012-05-15 11:47     ` Johannes Weiner [this message]
2012-05-15 11:47       ` Johannes Weiner
2012-05-07 20:41 ` [patch 00/10] (no)bootmem bits for 3.5 Sam Ravnborg
2012-05-07 20:41   ` Sam Ravnborg
2012-05-07 22:01   ` Johannes Weiner
2012-05-07 22:01     ` Johannes Weiner
2012-05-08 17:57     ` Sam Ravnborg
2012-05-08 17:57       ` Sam Ravnborg
2012-05-09 17:35       ` Tejun Heo
2012-05-09 17:35         ` Tejun Heo
2012-05-09 17:54         ` Christoph Lameter
2012-05-09 17:54           ` Christoph Lameter
2012-05-09 18:08           ` Tejun Heo
2012-05-09 18:08             ` Tejun Heo

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=20120515114716.GI1406@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shangw@linux.vnet.ibm.com \
    --cc=tj@kernel.org \
    --cc=yinghai@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 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.