mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Yinghai Lu <yinghai@kernel.org>
Cc: akpm@linux-foundation.org, torvalds@linux-foundation.org,
	davem@davemloft.net, shangw@linux.vnet.ibm.com, tj@kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [patch 046/181] mm: remove sparsemem allocation details from the bootmem allocator
Date: Sat, 23 Jun 2012 11:17:52 +0200	[thread overview]
Message-ID: <20120623091752.GK27816@cmpxchg.org> (raw)
In-Reply-To: <CAE9FiQXR+3k4QmOJe59xom+JW5JZAP3znRXQwdyqV5LMEPCw2g@mail.gmail.com>

On Fri, Jun 22, 2012 at 07:05:45PM -0700, Yinghai Lu wrote:
> On Fri, Jun 22, 2012 at 6:11 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> > On Tue, May 29, 2012 at 3:06 PM,  <akpm@linux-foundation.org> wrote:
> >> From: Johannes Weiner <hannes@cmpxchg.org>
> >> Subject: mm: remove sparsemem allocation details from the bootmem allocator
> >>
> >> 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.
> >>
> >> [akpm@linux-foundation.org: fix build]
> >> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> >> Acked-by: Tejun Heo <tj@kernel.org>
> >> Acked-by: David S. Miller <davem@davemloft.net>
> >> Cc: Yinghai Lu <yinghai@kernel.org>
> >> Cc: Gavin Shan <shangw@linux.vnet.ibm.com>
> >> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> >
> > hi, this one cause regression, will put usemap to last node's memory
> > instead of each node.
> 
> attached patch fixes the problem.

Sorry for the trouble and thanks for the patch!  The number of bugs in
these three lines is too damn high...

> Subject: [PATCH] mm: fix goal calculating with usemap
> 
> PAGE_SECTION_MASK should be used with pfn instead of pa.
> 
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> 
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 6a4bf91..fd00928 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -287,7 +287,7 @@ sparse_early_usemaps_alloc_pgdat_section(struct pglist_data *pgdat,
>  	 * from the same section as the pgdat where possible to avoid
>  	 * this problem.
>  	 */
> -	goal = __pa(pgdat) & PAGE_SECTION_MASK;
> +	goal = ((__pa(pgdat) >> PAGE_SHIFT) & PAGE_SECTION_MASK) << PAGE_SHIFT;

How about

	goal = __pa(pgdat) & (PAGE_SECTION_MASK << PAGE_SHIFT);

instead?

>  	host_pgdat = NODE_DATA(early_pfn_to_nid(goal >> PAGE_SHIFT));
>  	return __alloc_bootmem_node_nopanic(host_pgdat, size,
>  					    SMP_CACHE_BYTES, goal);

  reply	other threads:[~2012-06-23  9:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20120529220636.AAA66A0308@akpm.mtv.corp.google.com>
     [not found] ` <CAE9FiQVEq5j1zoKS31fgfG_3xZSyfqsjdDorDku-Sgj6BTShEg@mail.gmail.com>
2012-06-23  2:05   ` Yinghai Lu
2012-06-23  9:17     ` Johannes Weiner [this message]
2012-06-23 18:58       ` Yinghai Lu
2012-06-23 22:06         ` Johannes Weiner
2012-06-23 22:35           ` Yinghai Lu
2012-06-26  8:17             ` Johannes Weiner
2012-06-26 18:20               ` Yinghai Lu
2012-06-26 19:08                 ` Johannes Weiner

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=20120623091752.GK27816@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shangw@linux.vnet.ibm.com \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome