From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lai Jiangshan Subject: [RFC PATCH 15/23 V2] memory_hotplug: fix missing nodemask management Date: Thu, 2 Aug 2012 10:53:03 +0800 Message-ID: <1343875991-7533-16-git-send-email-laijs@cn.fujitsu.com> References: <1343875991-7533-1-git-send-email-laijs@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1343875991-7533-1-git-send-email-laijs-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Mel Gorman Cc: Christoph Lameter , Jiri Kosina , Dan Magenheimer , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Michal Hocko , Paul Gortmaker , Konstantin Khlebnikov , "H. Peter Anvin" , Sam Ravnborg , Gavin Shan , Rik van Riel , cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, Hugh Dickins , Ingo Molnar , Mel Gorman , KOSAKI Motohiro , David Rientjes , Petr Holasek , linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, Wanlong Gao , Djalal Harouni , Rusty Russell , Wen Congyang , Peter Zijlstra List-Id: linux-mm.kvack.org Currently memory_hotplug only manages the node_states[N_HIGH_MEMORY], it forgot to manage node_states[N_NORMAL_MEMORY]. fix it. Signed-off-by: Lai Jiangshan --- Documentation/memory-hotplug.txt | 2 +- mm/memory_hotplug.c | 23 +++++++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Documentation/memory-hotplug.txt b/Documentation/memory-hotplug.txt index 6d0c251..89f21b2 100644 --- a/Documentation/memory-hotplug.txt +++ b/Documentation/memory-hotplug.txt @@ -382,7 +382,7 @@ struct memory_notify { start_pfn is start_pfn of online/offline memory. nr_pages is # of pages of online/offline memory. -status_change_nid is set node id when N_HIGH_MEMORY of nodemask is (will be) +status_change_nid is set node id when N_MEMORY of nodemask is (will be) set/clear. It means a new(memoryless) node gets new memory by online and a node loses all memory. If this is -1, then nodemask status is not changed. If status_changed_nid >= 0, callback should create/discard structures for the diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 427bb29..c44b39e 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -522,8 +522,18 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages) init_per_zone_wmark_min(); if (onlined_pages) { + enum zone_type zoneid = zone_idx(zone); + kswapd_run(zone_to_nid(zone)); - node_set_state(zone_to_nid(zone), N_HIGH_MEMORY); + + node_set_state(nid, N_MEMORY); + if (zoneid <= ZONE_NORMAL && N_NORMAL_MEMORY != N_MEMORY) + node_set_state(nid, N_NORMAL_MEMORY); +#ifdef CONFIG_HIGMEM + if (zoneid <= ZONE_HIGHMEM && N_HIGH_MEMORY != N_MEMORY) + node_set_state(nid, N_HIGH_MEMORY); +#endif + } vm_total_pages = nr_free_pagecache_pages(); @@ -966,7 +976,16 @@ repeat: init_per_zone_wmark_min(); if (!node_present_pages(node)) { - node_clear_state(node, N_HIGH_MEMORY); + enum zone_type zoneid = zone_idx(zone); + + node_clear_state(node, N_MEMORY); + if (zoneid <= ZONE_NORMAL && N_NORMAL_MEMORY != N_MEMORY) + node_clear_state(node, N_NORMAL_MEMORY); +#ifdef CONFIG_HIGMEM + if (zoneid <= ZONE_HIGHMEM && N_HIGH_MEMORY != N_MEMORY) + node_clear_state(node, N_HIGH_MEMORY); +#endif + kswapd_stop(node); } -- 1.7.1