From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754488Ab2GJWSI (ORCPT ); Tue, 10 Jul 2012 18:18:08 -0400 Received: from zene.cmpxchg.org ([85.214.230.12]:53776 "EHLO zene.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754094Ab2GJWSG (ORCPT ); Tue, 10 Jul 2012 18:18:06 -0400 Date: Wed, 11 Jul 2012 00:17:50 +0200 From: Johannes Weiner To: Yinghai Lu Cc: akpm@linux-foundation.org, mm-commits@vger.kernel.org, tj@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [patch 1/2] mm: sparse: fix section usemap placement calculation Message-ID: <20120710221750.GI1779@cmpxchg.org> References: <20120626234630.A54C9A0341@akpm.mtv.corp.google.com> <20120710212005.GG1779@cmpxchg.org> <20120710221559.GH1779@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120710221559.GH1779@cmpxchg.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yinghai Lu 238305b "mm: remove sparsemem allocation details from the bootmem allocator" introduced a bug in the allocation goal calculation that put section usemaps not in the same section as the node descriptors, creating unnecessary hotplug dependencies between them: [ 0.000000] node 0 must be removed before remove section 16399 [ 0.000000] node 1 must be removed before remove section 16399 [ 0.000000] node 2 must be removed before remove section 16399 [ 0.000000] node 3 must be removed before remove section 16399 [ 0.000000] node 4 must be removed before remove section 16399 [ 0.000000] node 5 must be removed before remove section 16399 [ 0.000000] node 6 must be removed before remove section 16399 The reason is that it applies PAGE_SECTION_MASK to the physical address of the node descriptor when finding a suitable place to put the usemap, when this mask is actually intended to be used with PFNs. Because the PFN mask is wider, the target address will point beyond the wanted section holding the node descriptor and the node must be offlined before the section holding the usemap can go. Fix this by extending the mask to address width before use. Signed-off-by: Yinghai Lu Signed-off-by: Johannes Weiner --- mm/sparse.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/mm/sparse.c b/mm/sparse.c index 6a4bf91..e861397 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_SECTION_MASK << PAGE_SHIFT); host_pgdat = NODE_DATA(early_pfn_to_nid(goal >> PAGE_SHIFT)); return __alloc_bootmem_node_nopanic(host_pgdat, size, SMP_CACHE_BYTES, goal); -- 1.7.7.6 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx158.postini.com [74.125.245.158]) by kanga.kvack.org (Postfix) with SMTP id 081056B0071 for ; Tue, 10 Jul 2012 18:18:07 -0400 (EDT) Date: Wed, 11 Jul 2012 00:17:50 +0200 From: Johannes Weiner Subject: [patch 1/2] mm: sparse: fix section usemap placement calculation Message-ID: <20120710221750.GI1779@cmpxchg.org> References: <20120626234630.A54C9A0341@akpm.mtv.corp.google.com> <20120710212005.GG1779@cmpxchg.org> <20120710221559.GH1779@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120710221559.GH1779@cmpxchg.org> Sender: owner-linux-mm@kvack.org List-ID: To: Yinghai Lu Cc: akpm@linux-foundation.org, mm-commits@vger.kernel.org, tj@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org From: Yinghai Lu 238305b "mm: remove sparsemem allocation details from the bootmem allocator" introduced a bug in the allocation goal calculation that put section usemaps not in the same section as the node descriptors, creating unnecessary hotplug dependencies between them: [ 0.000000] node 0 must be removed before remove section 16399 [ 0.000000] node 1 must be removed before remove section 16399 [ 0.000000] node 2 must be removed before remove section 16399 [ 0.000000] node 3 must be removed before remove section 16399 [ 0.000000] node 4 must be removed before remove section 16399 [ 0.000000] node 5 must be removed before remove section 16399 [ 0.000000] node 6 must be removed before remove section 16399 The reason is that it applies PAGE_SECTION_MASK to the physical address of the node descriptor when finding a suitable place to put the usemap, when this mask is actually intended to be used with PFNs. Because the PFN mask is wider, the target address will point beyond the wanted section holding the node descriptor and the node must be offlined before the section holding the usemap can go. Fix this by extending the mask to address width before use. Signed-off-by: Yinghai Lu Signed-off-by: Johannes Weiner --- mm/sparse.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/mm/sparse.c b/mm/sparse.c index 6a4bf91..e861397 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_SECTION_MASK << PAGE_SHIFT); host_pgdat = NODE_DATA(early_pfn_to_nid(goal >> PAGE_SHIFT)); return __alloc_bootmem_node_nopanic(host_pgdat, size, SMP_CACHE_BYTES, goal); -- 1.7.7.6 -- 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/ . Don't email: email@kvack.org