diff options
author | Wen Congyang <wency@cn.fujitsu.com> | 2012-10-08 19:33:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-09 03:23:02 -0400 |
commit | a16cee10c7ab994546ed98d9abfd4de74050124a (patch) | |
tree | 19b44bd2d32047f69f77a36145a9f2ebb6b41d53 /mm | |
parent | c22331166b49b94b51424bb7fa1f83e09ad82734 (diff) |
memory-hotplug: preparation to notify memory block's state at memory hot remove
remove_memory() is called in two cases:
1. echo offline >/sys/devices/system/memory/memoryXX/state
2. hot remove a memory device
In the 1st case, the memory block's state is changed and the notification
that memory block's state changed is sent to userland after calling
remove_memory(). So user can notice memory block is changed.
But in the 2nd case, the memory block's state is not changed and the
notification is not also sent to userspcae even if calling
remove_memory(). So user cannot notice memory block is changed.
For adding the notification at memory hot remove, the patch just prepare
as follows:
1st case uses offline_pages() for offlining memory.
2nd case uses remove_memory() for offlining memory and changing memory block's
state and notifing the information.
The patch does not implement notification to remove_memory().
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Jiang Liu <liuj97@gmail.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memory_hotplug.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index ce690a911f1b..dfc0a6134c7c 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -874,7 +874,7 @@ check_pages_isolated(unsigned long start_pfn, unsigned long end_pfn) | |||
874 | return offlined; | 874 | return offlined; |
875 | } | 875 | } |
876 | 876 | ||
877 | static int __ref offline_pages(unsigned long start_pfn, | 877 | static int __ref __offline_pages(unsigned long start_pfn, |
878 | unsigned long end_pfn, unsigned long timeout) | 878 | unsigned long end_pfn, unsigned long timeout) |
879 | { | 879 | { |
880 | unsigned long pfn, nr_pages, expire; | 880 | unsigned long pfn, nr_pages, expire; |
@@ -1007,15 +1007,24 @@ out: | |||
1007 | return ret; | 1007 | return ret; |
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | int offline_pages(unsigned long start_pfn, unsigned long nr_pages) | ||
1011 | { | ||
1012 | return __offline_pages(start_pfn, start_pfn + nr_pages, 120 * HZ); | ||
1013 | } | ||
1014 | |||
1010 | int remove_memory(u64 start, u64 size) | 1015 | int remove_memory(u64 start, u64 size) |
1011 | { | 1016 | { |
1012 | unsigned long start_pfn, end_pfn; | 1017 | unsigned long start_pfn, end_pfn; |
1013 | 1018 | ||
1014 | start_pfn = PFN_DOWN(start); | 1019 | start_pfn = PFN_DOWN(start); |
1015 | end_pfn = start_pfn + PFN_DOWN(size); | 1020 | end_pfn = start_pfn + PFN_DOWN(size); |
1016 | return offline_pages(start_pfn, end_pfn, 120 * HZ); | 1021 | return __offline_pages(start_pfn, end_pfn, 120 * HZ); |
1017 | } | 1022 | } |
1018 | #else | 1023 | #else |
1024 | int offline_pages(unsigned long start_pfn, unsigned long nr_pages) | ||
1025 | { | ||
1026 | return -EINVAL; | ||
1027 | } | ||
1019 | int remove_memory(u64 start, u64 size) | 1028 | int remove_memory(u64 start, u64 size) |
1020 | { | 1029 | { |
1021 | return -EINVAL; | 1030 | return -EINVAL; |