diff options
author | Lai Jiangshan <laijs@cn.fujitsu.com> | 2012-12-11 19:01:03 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-11 20:22:23 -0500 |
commit | d9713679dbd2a6ecb840cd5b65a3ec555c1ec3d4 (patch) | |
tree | b998ae43dc18e7459cab5a2cb5ba12900c96c7e1 /Documentation/memory-hotplug.txt | |
parent | 6dcd73d7011ba9046f9b98e7f7c9d958f5810e6b (diff) |
memory_hotplug: fix possible incorrect node_states[N_NORMAL_MEMORY]
Currently memory_hotplug only manages the node_states[N_HIGH_MEMORY], it
forgets to manage node_states[N_NORMAL_MEMORY]. This may cause
node_states[N_NORMAL_MEMORY] to become incorrect.
Example, if a node is empty before online, and we online a memory which is
in ZONE_NORMAL. And after online, node_states[N_HIGH_MEMORY] is correct,
but node_states[N_NORMAL_MEMORY] is incorrect, the online code doesn't set
the new online node to node_states[N_NORMAL_MEMORY].
The same thing will happen when offlining (the offline code doesn't clear
the node from node_states[N_NORMAL_MEMORY] when needed). Some memory
managment code depends node_states[N_NORMAL_MEMORY], so we have to fix up
the node_states[N_NORMAL_MEMORY].
We add node_states_check_changes_online() and
node_states_check_changes_offline() to detect whether
node_states[N_HIGH_MEMORY] and node_states[N_NORMAL_MEMORY] are changed
while hotpluging.
Also add @status_change_nid_normal to struct memory_notify, thus the
memory hotplug callbacks know whether the node_states[N_NORMAL_MEMORY] are
changed. (We can add a @flags and reuse @status_change_nid instead of
introducing @status_change_nid_normal, but it will add much more
complexity in memory hotplug callback in every subsystem. So introducing
@status_change_nid_normal is better and it doesn't change the sematics of
@status_change_nid)
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Rob Landley <rob@landley.net>
Cc: Jiang Liu <jiang.liu@huawei.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/memory-hotplug.txt')
-rw-r--r-- | Documentation/memory-hotplug.txt | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Documentation/memory-hotplug.txt b/Documentation/memory-hotplug.txt index 6d0c2519cf47..6e6cbc78f329 100644 --- a/Documentation/memory-hotplug.txt +++ b/Documentation/memory-hotplug.txt | |||
@@ -377,15 +377,18 @@ The third argument is passed by pointer of struct memory_notify. | |||
377 | struct memory_notify { | 377 | struct memory_notify { |
378 | unsigned long start_pfn; | 378 | unsigned long start_pfn; |
379 | unsigned long nr_pages; | 379 | unsigned long nr_pages; |
380 | int status_change_nid_normal; | ||
380 | int status_change_nid; | 381 | int status_change_nid; |
381 | } | 382 | } |
382 | 383 | ||
383 | start_pfn is start_pfn of online/offline memory. | 384 | start_pfn is start_pfn of online/offline memory. |
384 | nr_pages is # of pages of online/offline memory. | 385 | nr_pages is # of pages of online/offline memory. |
386 | status_change_nid_normal is set node id when N_NORMAL_MEMORY of nodemask | ||
387 | is (will be) set/clear, if this is -1, then nodemask status is not changed. | ||
385 | status_change_nid is set node id when N_HIGH_MEMORY of nodemask is (will be) | 388 | status_change_nid is set node id when N_HIGH_MEMORY of nodemask is (will be) |
386 | set/clear. It means a new(memoryless) node gets new memory by online and a | 389 | set/clear. It means a new(memoryless) node gets new memory by online and a |
387 | node loses all memory. If this is -1, then nodemask status is not changed. | 390 | node loses all memory. If this is -1, then nodemask status is not changed. |
388 | If status_changed_nid >= 0, callback should create/discard structures for the | 391 | If status_changed_nid* >= 0, callback should create/discard structures for the |
389 | node if necessary. | 392 | node if necessary. |
390 | 393 | ||
391 | -------------- | 394 | -------------- |