
Fixes a bug with permanent kmaps.  It keeps a pte to a page for long after a kunmap() has been done to keep global tlb flushes to a minimum. This is OK, except that it works out a pfn and a struct page from that pte when it flushes, which can be long after the page is removed.  

This flushes before removal
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
---

 memhotplug-dave/include/asm-i386/highmem.h |    1 +
 memhotplug-dave/mm/memory_hotplug.c        |    8 ++++++++
 2 files changed, 9 insertions(+)

diff -puN mm/memory_hotplug.c~N3-i386-invalidate-kmap-ptes mm/memory_hotplug.c
--- memhotplug/mm/memory_hotplug.c~N3-i386-invalidate-kmap-ptes	2004-09-27 10:32:40.000000000 -0700
+++ memhotplug-dave/mm/memory_hotplug.c	2004-09-27 10:32:40.000000000 -0700
@@ -22,6 +22,7 @@
 #include <linux/memory_hotplug.h>
 
 #include <asm/tlbflush.h>
+#include <asm/highmem.h>
 
 static struct page *__kmalloc_section_memmap(unsigned long nr_pages)
 {
@@ -181,6 +182,13 @@ int __remove_pages(struct zone *zone, un
 		unregister_memory_section(section);
 	}
 
+	/*
+	 * Permanent kmaps keep ptes to a page long after a kunmap() to
+	 * keep global tlb flushes to a minimum.  When it flushes, it
+	 * works out a pfn and a struct page from that pte which can be
+	 * long after the page is removed.  Flush before removal.
+	 */
+	flush_all_zero_pkmaps();
 	invalidate_phys_mapping(start_pfn, nr_pages);
 
 	return 0;
diff -puN mm/highmem.c~N3-i386-invalidate-kmap-ptes mm/highmem.c
diff -puN include/asm-i386/highmem.h~N3-i386-invalidate-kmap-ptes include/asm-i386/highmem.h
--- memhotplug/include/asm-i386/highmem.h~N3-i386-invalidate-kmap-ptes	2004-09-27 10:32:40.000000000 -0700
+++ memhotplug-dave/include/asm-i386/highmem.h	2004-09-27 10:32:40.000000000 -0700
@@ -56,6 +56,7 @@ extern void kmap_init(void);
 
 extern void * FASTCALL(kmap_high(struct page *page));
 extern void FASTCALL(kunmap_high(struct page *page));
+extern void flush_all_zero_pkmaps(void);
 
 void *kmap(struct page *page);
 void kunmap(struct page *page);
_
