aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/memory.h
diff options
context:
space:
mode:
authorRobert Jennings <rcj@linux.vnet.ibm.com>2009-12-17 09:44:38 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-12-17 22:53:36 -0500
commit925cc71e512a29e2594bcc17dc58d0a0e9c4d524 (patch)
tree7240ccf6ba713cc180d388a28f00c1a43293bc14 /include/linux/memory.h
parent55639353a0035052d9ea6cfe4dde0ac7fcbb2c9f (diff)
mm: Add notifier in pageblock isolation for balloon drivers
Memory balloon drivers can allocate a large amount of memory which is not movable but could be freed to accomodate memory hotplug remove. Prior to calling the memory hotplug notifier chain the memory in the pageblock is isolated. Currently, if the migrate type is not MIGRATE_MOVABLE the isolation will not proceed, causing the memory removal for that page range to fail. Rather than failing pageblock isolation if the migrateteype is not MIGRATE_MOVABLE, this patch checks if all of the pages in the pageblock, and not on the LRU, are owned by a registered balloon driver (or other entity) using a notifier chain. If all of the non-movable pages are owned by a balloon, they can be freed later through the memory notifier chain and the range can still be isolated in set_migratetype_isolate(). Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Ingo Molnar <mingo@elte.hu> Cc: Brian King <brking@linux.vnet.ibm.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Gerald Schaefer <geralds@linux.vnet.ibm.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'include/linux/memory.h')
-rw-r--r--include/linux/memory.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 37fa19b34ef5..1adfe779eb99 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -50,6 +50,19 @@ struct memory_notify {
50 int status_change_nid; 50 int status_change_nid;
51}; 51};
52 52
53/*
54 * During pageblock isolation, count the number of pages within the
55 * range [start_pfn, start_pfn + nr_pages) which are owned by code
56 * in the notifier chain.
57 */
58#define MEM_ISOLATE_COUNT (1<<0)
59
60struct memory_isolate_notify {
61 unsigned long start_pfn; /* Start of range to check */
62 unsigned int nr_pages; /* # pages in range to check */
63 unsigned int pages_found; /* # pages owned found by callbacks */
64};
65
53struct notifier_block; 66struct notifier_block;
54struct mem_section; 67struct mem_section;
55 68
@@ -76,14 +89,28 @@ static inline int memory_notify(unsigned long val, void *v)
76{ 89{
77 return 0; 90 return 0;
78} 91}
92static inline int register_memory_isolate_notifier(struct notifier_block *nb)
93{
94 return 0;
95}
96static inline void unregister_memory_isolate_notifier(struct notifier_block *nb)
97{
98}
99static inline int memory_isolate_notify(unsigned long val, void *v)
100{
101 return 0;
102}
79#else 103#else
80extern int register_memory_notifier(struct notifier_block *nb); 104extern int register_memory_notifier(struct notifier_block *nb);
81extern void unregister_memory_notifier(struct notifier_block *nb); 105extern void unregister_memory_notifier(struct notifier_block *nb);
106extern int register_memory_isolate_notifier(struct notifier_block *nb);
107extern void unregister_memory_isolate_notifier(struct notifier_block *nb);
82extern int register_new_memory(int, struct mem_section *); 108extern int register_new_memory(int, struct mem_section *);
83extern int unregister_memory_section(struct mem_section *); 109extern int unregister_memory_section(struct mem_section *);
84extern int memory_dev_init(void); 110extern int memory_dev_init(void);
85extern int remove_memory_block(unsigned long, struct mem_section *, int); 111extern int remove_memory_block(unsigned long, struct mem_section *, int);
86extern int memory_notify(unsigned long val, void *v); 112extern int memory_notify(unsigned long val, void *v);
113extern int memory_isolate_notify(unsigned long val, void *v);
87extern struct memory_block *find_memory_block(struct mem_section *); 114extern struct memory_block *find_memory_block(struct mem_section *);
88#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) 115#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
89enum mem_add_context { BOOT, HOTPLUG }; 116enum mem_add_context { BOOT, HOTPLUG };