Making hotremovable attribute with memory section[1/4]
Subsystems (4)
Forwarded by Yasunori Goto <[email protected]> ----------------------- Original Message -----------------------
From: Yasunori Goto <[email protected]> To: [email protected] Date: Mon, 16 Aug 2004 14:36:13 -0700
Subject: [Lhms-devel] Making hotremovable attribute with memory section[1/4]
----
-----------------------------------------
This is a patche to add attribute hot-removable into section. Kernel will allocate pages by this attribute.
Reason:
There are some memories which can't be hot-removed.
ex) kernel text/stack, kmalloc(), etc...
So, we should identify un-removable memory section to hot-remove memory easily. This patch is for it.
The amount of memories that can actually be hot-removed
will be maximized by localizing un-removable memories.
At first, we give up to hot-remove of 'un-removable memory'.
However, un-removable memory may be reduced by improvement of implementation.
Implementation:
- Section has a flag. one bit is to indicate removable or not.
- free_area is divided into hotremovable and removable.
o If page requester requires swap-outable memory (this will be indicated by __GFP_HOTREMOVABLE), kernel will allocate from hot-removable free_area as much as possible.
o If __GFP_HOTREMOVABLE isn't indicated at page allocation request, kernel will give only un-removable free_area.
o When a page will be returned to free_area, kernel will identify sections to which the page belongs, and will return each free_area by it.
Note:
- per_cpu_pages also have to be divided, but this patch doesn't include it. (Other patch include it.)
- __GFP_HOTREMOVABLE is defined by other patch.
---
hotremovable-goto/include/linux/mmzone.h | 11 + hotremovable-goto/include/linux/nonlinear.h | 5 hotremovable-goto/mm/nonlinear.c | 9 + hotremovable-goto/mm/page_alloc.c | 160 ++++++++++++++++------------ 4 files changed, 121 insertions(+), 64 deletions(-)
include/linux/mmzone.h renamed from include/linux/mmzone.h~divide_free_area +10 -1
@@ -32,6 +32,15 @@ struct free_area { } alloc_type; }; +struct area_type { +struct free_area free_area[MAX_ORDER ]; +}; + +#ifdef CONFIG_MEMORY_HOTPLUG +#define NUM_AREA_TYPE 2 +#else +#define NUM_AREA_TYPE 1 +#endif struct pglist_data ;/*
@@ -171,7 +180,7 @@ struct zone {/* * free areas of different sizes */ -struct free_area free_area[MAX_ORDER ]; +struct area_type area_type[NUM_AREA_TYPE ];/* 0: un-removable , 1: removable memory */ /* * wait_table -- the array holding the hash table
include/linux/nonlinear.h renamed from include/linux/nonlinear.h~divide_free_area +5 -0
@@ -39,6 +39,10 @@ static inline void alloc_memmap(struct pstruct mem_section {unsigned int phys_section;struct page *mem_map; +unsigned char flags; + +#define SECTION_REMOVABLE (1 << 3) + };extern struct mem_section mem_section[];
@@ -135,6 +139,7 @@ extern struct page *pfn_to_page(unsignedextern struct page *lpfn_to_page (unsigned long pfn);extern unsigned long page_to_pfn (struct page *page);extern unsigned long page_to_lpfn (struct page *page); +extern unsigned int page_is_removable (struct page *page);#endif /* CONFIG_NONLINEAR */ #endif /* __LINUX_NONLINEAR_H_ */
mm/nonlinear.c renamed from mm/nonlinear.c~divide_free_area +9 -0
@@ -175,6 +175,15 @@ page_to_pfn(struct page *page)return section_to_pfn (mem_section[page->section].phys_section) + (page - mem_section[page->section].mem_map); } + +unsigned int +page_is_removable (struct page *page) +{ +int index = page->section; +return !!(mem_section[index].flags &SECTION_REMOVABLE ); +} + +EXPORT_SYMBOL (pfn_to_page);EXPORT_SYMBOL (page_to_pfn);
mm/page_alloc.c renamed from mm/page_alloc.c~divide_free_area +97 -63
307 lines not on this page · raw message
_
Signature · 26 lines
Yasunori Goto <ygoto at us.fujitsu.com> ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ Lhms-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/lhms-devel --------------------- Original Message Ends -------------------- -- Yasunori Goto <ygoto at us.fujitsu.com> -- 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>