Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758334AbYJIG2v (ORCPT ); Thu, 9 Oct 2008 02:28:51 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755735AbYJIG2n (ORCPT ); Thu, 9 Oct 2008 02:28:43 -0400 Received: from mga02.intel.com ([134.134.136.20]:49718 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752087AbYJIG2n (ORCPT ); Thu, 9 Oct 2008 02:28:43 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.33,382,1220252400"; d="scan'208";a="345796139" Date: Thu, 9 Oct 2008 14:28:31 +0800 From: Shaohua Li To: Yinghai Lu Cc: lkml , Andrew Morton , Ingo Molnar Subject: Re: [patch]x86: arch_add_memory round up address Message-ID: <20081009062831.GA9024@sli10-desk.sh.intel.com> References: <1223530290.30941.9.camel@sli10-desk.sh.intel.com> <86802c440810082304j3274555etb7eca011f7459253@mail.gmail.com> <1223532485.7312.0.camel@sli10-desk.sh.intel.com> <86802c440810082322s4eb7e7e6ib60f68de316b06bc@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86802c440810082322s4eb7e7e6ib60f68de316b06bc@mail.gmail.com> User-Agent: Mutt/1.5.17+20080114 (2008-01-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1864 Lines: 39 On Thu, Oct 09, 2008 at 02:22:50PM +0800, Yinghai Lu wrote: > On Wed, Oct 8, 2008 at 11:08 PM, Shaohua Li wrote: > > On Thu, 2008-10-09 at 14:04 +0800, Yinghai Lu wrote: > >> On Wed, Oct 8, 2008 at 10:31 PM, Shaohua Li wrote: > >> > Round up address to a page, otherwise the last page isn't mapped. > >> > > >> > Signed-off-by: Shaohua Li > >> > --- > >> > arch/x86/mm/init_64.c | 3 ++- > >> > 1 file changed, 2 insertions(+), 1 deletion(-) > >> > > >> > Index: linux/arch/x86/mm/init_64.c > >> > =================================================================== > >> > --- linux.orig/arch/x86/mm/init_64.c 2008-10-09 11:42:33.000000000 +0800 > >> > +++ linux/arch/x86/mm/init_64.c 2008-10-09 11:43:22.000000000 +0800 > >> > @@ -721,7 +721,8 @@ int arch_add_memory(int nid, u64 start, > >> > unsigned long nr_pages = size >> PAGE_SHIFT; > >> > int ret; > >> > > >> > - last_mapped_pfn = init_memory_mapping(start, start + size-1); > >> > + last_mapped_pfn = init_memory_mapping(start, > >> > + round_up(start + size-1, PAGE_SIZE)); > >> > if (last_mapped_pfn > max_pfn_mapped) > >> > max_pfn_mapped = last_mapped_pfn; > >> > >> should use > >> > >> last_mapped_pfn = init_memory_mapping(start, start + size); > > No, this still can't guarantee page aligned, though this works in my > > test > > who will call arch_add_memory? that should be start and size already > be page aligned. It's memory hotplug. Doing a round up is always ok and safe even it might be already aligned. -- 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/