From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760504AbYDCFpm (ORCPT ); Thu, 3 Apr 2008 01:45:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759671AbYDCFp1 (ORCPT ); Thu, 3 Apr 2008 01:45:27 -0400 Received: from fgwmail7.fujitsu.co.jp ([192.51.44.37]:42040 "EHLO fgwmail7.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759581AbYDCFp0 (ORCPT ); Thu, 3 Apr 2008 01:45:26 -0400 Date: Thu, 03 Apr 2008 14:44:22 +0900 From: Yasunori Goto To: Badari Pulavarty Subject: [Patch 004/005](memory hotplug)allocate usemap on the section with pgdat Cc: Andrew Morton , Linux Kernel ML , Yinghai Lu , linux-mm In-Reply-To: <20080403140221.D1F2.E1E9C6FF@jp.fujitsu.com> References: <20080403140221.D1F2.E1E9C6FF@jp.fujitsu.com> X-Mailer-Plugin: BkASPil for Becky!2 Ver.2.068 Message-Id: <20080403144159.D1FE.E1E9C6FF@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver. 2.45 [ja] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Usemaps are allocated on the section which has pgdat by this. Because usemap size is very small, many usemaps for sections are allocated on only one page. The page will be quite hard to be removed until removing all other sections. This dependency is not desirable for memory removing. Pgdat has similar feature. If sections has pgdat area, it must be the last section for removing on the node. This is to collect the cause pages of its dependency on one section. If other sections doesn't have any dependency, this section will be able to be removed finally. Signed-off-by: Yasunori Goto mm/sparse.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) Index: current/mm/sparse.c =================================================================== --- current.orig/mm/sparse.c 2008-04-01 20:59:07.000000000 +0900 +++ current/mm/sparse.c 2008-04-01 20:59:09.000000000 +0900 @@ -238,13 +238,23 @@ } #endif /* CONFIG_MEMORY_HOTPLUG */ -static unsigned long *__init sparse_early_usemap_alloc(unsigned long pnum) +static unsigned long *__init sparse_early_usemap_alloc(int pnum) { - unsigned long *usemap; + unsigned long *usemap, section_nr; struct mem_section *ms = __nr_to_section(pnum); int nid = sparse_early_nid(ms); + struct pglist_data *pgdat = NODE_DATA(nid); + + /* + * This is allocated on same section of pgdat. + * It will not be freed until other sections hot-removing on the node. + * Pgdat has same feature. This collects all usemap on the same + * section. + */ + + section_nr = pfn_to_section_nr(__pa(pgdat) >> PAGE_SHIFT); + usemap = alloc_bootmem_section(usemap_size(), section_nr); - usemap = alloc_bootmem_node(NODE_DATA(nid), usemap_size()); if (usemap) return usemap; -- Yasunori Goto