From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753565Ab2LZD4j (ORCPT ); Tue, 25 Dec 2012 22:56:39 -0500 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:33044 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752971Ab2LZD4f (ORCPT ); Tue, 25 Dec 2012 22:56:35 -0500 X-SecurityPolicyCheck: OK by SHieldMailChecker v1.8.4 Message-ID: <50DA7533.6060407@jp.fujitsu.com> Date: Wed, 26 Dec 2012 12:55:31 +0900 From: Kamezawa Hiroyuki User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Tang Chen CC: akpm@linux-foundation.org, rientjes@google.com, liuj97@gmail.com, len.brown@intel.com, benh@kernel.crashing.org, paulus@samba.org, cl@linux.com, minchan.kim@gmail.com, kosaki.motohiro@jp.fujitsu.com, isimatu.yasuaki@jp.fujitsu.com, wujianguo@huawei.com, wency@cn.fujitsu.com, hpa@zytor.com, linfeng@cn.fujitsu.com, laijs@cn.fujitsu.com, mgorman@suse.de, yinghai@kernel.org, x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-acpi@vger.kernel.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-ia64@vger.kernel.org, cmetcalf@tilera.com, sparclinux@vger.kernel.org Subject: Re: [PATCH v5 14/14] memory-hotplug: free node_data when a node is offlined References: <1356350964-13437-1-git-send-email-tangchen@cn.fujitsu.com> <1356350964-13437-15-git-send-email-tangchen@cn.fujitsu.com> In-Reply-To: <1356350964-13437-15-git-send-email-tangchen@cn.fujitsu.com> Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (2012/12/24 21:09), Tang Chen wrote: > From: Wen Congyang > > We call hotadd_new_pgdat() to allocate memory to store node_data. So we > should free it when removing a node. > > Signed-off-by: Wen Congyang I'm sorry but is it safe to remove pgdat ? All zone cache and zonelists are properly cleared/rebuilded in synchronous way ? and No threads are visinting zone in vmscan.c ? Thanks, -Kame > --- > mm/memory_hotplug.c | 20 +++++++++++++++++++- > 1 files changed, 19 insertions(+), 1 deletions(-) > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index f8a1d2f..447fa24 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -1680,9 +1680,12 @@ static int check_cpu_on_node(void *data) > /* offline the node if all memory sections of this node are removed */ > static void try_offline_node(int nid) > { > + pg_data_t *pgdat = NODE_DATA(nid); > unsigned long start_pfn = NODE_DATA(nid)->node_start_pfn; > - unsigned long end_pfn = start_pfn + NODE_DATA(nid)->node_spanned_pages; > + unsigned long end_pfn = start_pfn + pgdat->node_spanned_pages; > unsigned long pfn; > + struct page *pgdat_page = virt_to_page(pgdat); > + int i; > > for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) { > unsigned long section_nr = pfn_to_section_nr(pfn); > @@ -1709,6 +1712,21 @@ static void try_offline_node(int nid) > */ > node_set_offline(nid); > unregister_one_node(nid); > + > + if (!PageSlab(pgdat_page) && !PageCompound(pgdat_page)) > + /* node data is allocated from boot memory */ > + return; > + > + /* free waittable in each zone */ > + for (i = 0; i < MAX_NR_ZONES; i++) { > + struct zone *zone = pgdat->node_zones + i; > + > + if (zone->wait_table) > + vfree(zone->wait_table); > + } > + > + arch_refresh_nodedata(nid, NULL); > + arch_free_nodedata(pgdat); > } > > int __ref remove_memory(int nid, u64 start, u64 size) >