Skip to contentSkip to conversation

pearing off zone from physical memory layout [4/10] add memory layout subsystem

RFC New KAMEZAWA Hiroyuki 1 participant 1 message Feb 3, 2006 Memory management

lore
Share & tools
lore
#0 lore raw

RFC 1/1 pearing off zone from physical memory layout [4/10] add memory layout subsystem

Some codes needs information memory layout per zones. This memory_map list will support them.
This structure is rarely used.

ARCH_HAS_REGISTE_MEMORY_ZONE is defined for some archs which have sparse zone, holes in a zone.
Now, code for such arch is not available
(I'll do one by one. please notify if there is such arch other than ia64.).

For managing memory_map_list, I used a simple list, without sorting, coalescing etc..

==

include/linux/memorymap.h new file +43 -0
Index: hogehoge/include/linux/memorymap.h
===================================================================
@@ -0,0 +1,43 @@
+#ifndef __LINUX_MEMORYMAP_H
+#define __LINUX_MEMORYMAP_H
+/* included from mm.h */
+/*
+ * managing information of memory map.
+ * showing the range [start_pfn, end_pfn)
+ */
+struct memory_map {
+	struct list_head list;
+	unsigned long start_pfn;
+	unsigned long end_pfn;
+	struct zone *zone;
+};
+
+extern struct list_head memory_map_list;
+
+extern void setup_memory_map(void) __init;
+extern void register_memory_zone(struct zone *zone,
+		                unsigned long start_pfn,
+				unsigned long nr_pages);
+extern void unregister_memory(unsigned long start_pfn, unsigned long nr_pages);
+
+#ifdef ARCH_HAS_REGISTER_MEMOEY_ZONE /* for archs which have memory holes in zone */
+extern void arch_register_memory_zone(struct zone *zone,
+				      unsigned long start_pfn, unsigned long nr_pages);
+#else
+static inline void arch_register_memory_zone(struct zone *zone,
+					unsigned long start_pfn, unsigned long nr_pages)
+{
+	return register_memory_zone(zone, start_pfn, nr_pages);
+}
+#endif
+
+#ifdef CONFIG_MEMORY_HOTPLUG
+extern void memory_resize_lock(void);
+extern void memory_resize_unlock(void);
+#else
+static inline void memory_resize_lock(void) {}
+static inline void memory_resize_unlock(void) {}
+#endif
+
+
+#endif
mm/memory_map.c new file +100 -0

100 lines not on this page · raw message

mm/Makefile +1 -1
Index: hogehoge/mm/Makefile
===================================================================
@@ -10,7 +10,7 @@ mmu-$(CONFIG_MMU)	:= fremap.o highmem.o
 obj-y			:= bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \
 			   page_alloc.o page-writeback.o pdflush.o \
 			   readahead.o swap.o truncate.o vmscan.o \
-			   prio_tree.o util.o $(mmu-y)
+			   prio_tree.o util.o memory_map.o $(mmu-y)
 
 obj-$(CONFIG_SWAP)	+= page_io.o swap_state.o swapfile.o thrash.o
 obj-$(CONFIG_HUGETLBFS)	+= hugetlb.o

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>