diff options
author | Yasunori Goto <y-goto@jp.fujitsu.com> | 2007-10-21 19:41:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-22 11:13:17 -0400 |
commit | 7b78d335ac15b10bbcb0397c635d7f0d569b0270 (patch) | |
tree | 3e49006c0166ff8bcc6e11b401437fc31d875ec8 /include/linux/memory.h | |
parent | 10020ca246c55744dad815ad4f15e1f488ca55a8 (diff) |
memory hotplug: rearrange memory hotplug notifier
Current memory notifier has some defects yet. (Fortunately, nothing uses
it.) This patch is to fix and rearrange for them.
- Add information of start_pfn, nr_pages, and node id if node status is
changes from/to memoryless node for callback functions.
Callbacks can't do anything without those information.
- Add notification going-online status.
It is necessary for creating per node structure before the node's
pages are available.
- Move GOING_OFFLINE status notification after page isolation.
It is good place for return memory like cache for callback,
because returned page is not used again.
- Make CANCEL events for rollingback when error occurs.
- Delete MEM_MAPPING_INVALID notification. It will be not used.
- Fix compile error of (un)register_memory_notifier().
Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/memory.h')
-rw-r--r-- | include/linux/memory.h | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/include/linux/memory.h b/include/linux/memory.h index 654ef5544878..ec376e482abb 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h | |||
@@ -41,18 +41,15 @@ struct memory_block { | |||
41 | #define MEM_ONLINE (1<<0) /* exposed to userspace */ | 41 | #define MEM_ONLINE (1<<0) /* exposed to userspace */ |
42 | #define MEM_GOING_OFFLINE (1<<1) /* exposed to userspace */ | 42 | #define MEM_GOING_OFFLINE (1<<1) /* exposed to userspace */ |
43 | #define MEM_OFFLINE (1<<2) /* exposed to userspace */ | 43 | #define MEM_OFFLINE (1<<2) /* exposed to userspace */ |
44 | #define MEM_GOING_ONLINE (1<<3) | ||
45 | #define MEM_CANCEL_ONLINE (1<<4) | ||
46 | #define MEM_CANCEL_OFFLINE (1<<5) | ||
44 | 47 | ||
45 | /* | 48 | struct memory_notify { |
46 | * All of these states are currently kernel-internal for notifying | 49 | unsigned long start_pfn; |
47 | * kernel components and architectures. | 50 | unsigned long nr_pages; |
48 | * | 51 | int status_change_nid; |
49 | * For MEM_MAPPING_INVALID, all notifier chains with priority >0 | 52 | }; |
50 | * are called before pfn_to_page() becomes invalid. The priority=0 | ||
51 | * entry is reserved for the function that actually makes | ||
52 | * pfn_to_page() stop working. Any notifiers that want to be called | ||
53 | * after that should have priority <0. | ||
54 | */ | ||
55 | #define MEM_MAPPING_INVALID (1<<3) | ||
56 | 53 | ||
57 | struct notifier_block; | 54 | struct notifier_block; |
58 | struct mem_section; | 55 | struct mem_section; |
@@ -69,12 +66,18 @@ static inline int register_memory_notifier(struct notifier_block *nb) | |||
69 | static inline void unregister_memory_notifier(struct notifier_block *nb) | 66 | static inline void unregister_memory_notifier(struct notifier_block *nb) |
70 | { | 67 | { |
71 | } | 68 | } |
69 | static inline int memory_notify(unsigned long val, void *v) | ||
70 | { | ||
71 | return 0; | ||
72 | } | ||
72 | #else | 73 | #else |
74 | extern int register_memory_notifier(struct notifier_block *nb); | ||
75 | extern void unregister_memory_notifier(struct notifier_block *nb); | ||
73 | extern int register_new_memory(struct mem_section *); | 76 | extern int register_new_memory(struct mem_section *); |
74 | extern int unregister_memory_section(struct mem_section *); | 77 | extern int unregister_memory_section(struct mem_section *); |
75 | extern int memory_dev_init(void); | 78 | extern int memory_dev_init(void); |
76 | extern int remove_memory_block(unsigned long, struct mem_section *, int); | 79 | extern int remove_memory_block(unsigned long, struct mem_section *, int); |
77 | 80 | extern int memory_notify(unsigned long val, void *v); | |
78 | #define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) | 81 | #define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) |
79 | 82 | ||
80 | 83 | ||