lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1343887288-8866-16-git-send-email-laijs@cn.fujitsu.com>
Date:	Thu, 2 Aug 2012 14:01:20 +0800
From:	Lai Jiangshan <laijs@...fujitsu.com>
To:	Mel Gorman <mel@....ul.ie>, linux-kernel@...r.kernel.org
Cc:	Lai Jiangshan <laijs@...fujitsu.com>,
	Rob Landley <rob@...dley.net>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Paul Gortmaker <paul.gortmaker@...driver.com>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	David Rientjes <rientjes@...gle.com>,
	Wen Congyang <wency@...fujitsu.com>, linux-doc@...r.kernel.org,
	linux-mm@...ck.org
Subject: [RFC PATCH 15/23 V2] memory_hotplug: fix missing nodemask management

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 <laijs@...fujitsu.com>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ