Signed-off-by: Dave Hansen DESC mhp.h-compile EDESC Signed-off-by: Dave Hansen --- memhotplug-dave/arch/i386/mm/init.c | 37 ++++++++++++++++++++++++++++++++++++ memhotplug-dave/mm/highmem.c | 2 + mm/memory_hotplug.c | 0 3 files changed, 39 insertions(+) diff -puN arch/i386/mm/init.c~P1-i386-remove arch/i386/mm/init.c --- memhotplug/arch/i386/mm/init.c~P1-i386-remove 2005-07-28 13:51:18.000000000 -0700 +++ memhotplug-dave/arch/i386/mm/init.c 2005-07-28 13:51:18.000000000 -0700 @@ -665,6 +665,43 @@ int add_memory(u64 start, u64 size) int remove_memory(u64 start, u64 size) { + struct zone *zone; + unsigned long start_pfn, end_pfn, nr_pages; + + start_pfn = start >> PAGE_SHIFT; + nr_pages = size >> PAGE_SHIFT; + end_pfn = start_pfn + nr_pages; + + /* + * check to see which zone the page range is in. If + * not in a zone where we allow hotplug (i.e. highmem), + * just fail it right now. + */ + zone = page_zone(pfn_to_page(start_pfn)); + + printk(KERN_DEBUG "%s(): memory will be removed from " + "the %s zone\n", __func__, zone->name); + + /* + * not handling removing memory ranges that + * overlap multiple zones yet + */ + if (zone != page_zone(pfn_to_page(end_pfn-1))) + goto overlap; + + /* make sure it is in highmem */ + if (!is_highmem(zone)) { + printk(KERN_DEBUG "%s(): range to be removed must be in highmem!\n", + __func__); + goto not_highmem; + } + + return __remove_pages(zone, start_pfn, nr_pages); + +overlap: + printk(KERN_DEBUG "%s(): memory range to be removed overlaps " + "multiple zones!!!\n", __func__); +not_highmem: return -EINVAL; } #endif diff -puN mm/highmem.c~P1-i386-remove mm/highmem.c --- memhotplug/mm/highmem.c~P1-i386-remove 2005-07-28 13:51:18.000000000 -0700 +++ memhotplug-dave/mm/highmem.c 2005-07-28 13:51:18.000000000 -0700 @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include static mempool_t *page_pool, *isa_page_pool; diff -puN mm/memory_hotplug.c~P1-i386-remove mm/memory_hotplug.c _