Since mm/page_alloc.c needs to be changed in two places anyway, the
same effect can (now) be achieved with less modifications elsewhere.
As usual, written and tested against 2.6.23 and made apply against
2.6.18 without further testing.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
Index: head-2007-10-15/arch/um/kernel/physmem.c
===================================================================
--- head-2007-10-15.orig/arch/um/kernel/physmem.c
+++ head-2007-10-15/arch/um/kernel/physmem.c
@@ -226,7 +226,7 @@ EXPORT_SYMBOL(physmem_forget_descriptor)
EXPORT_SYMBOL(physmem_remove_mapping);
EXPORT_SYMBOL(physmem_subst_mapping);
-int arch_free_page(struct page *page, int order)
+void arch_free_page(struct page *page, int order)
{
void *virt;
int i;
@@ -235,8 +235,6 @@ void arch_free_page(struct page *page, i
virt = __va(page_to_phys(page + i));
physmem_remove_mapping(virt);
}
-
- return 0;
}
int is_remapped(void *virt)
Index: head-2007-10-15/include/asm-i386/mach-xen/asm/page.h
===================================================================
--- head-2007-10-15.orig/include/asm-i386/mach-xen/asm/page.h
+++ head-2007-10-15/include/asm-i386/mach-xen/asm/page.h
@@ -37,14 +37,6 @@
#include <xen/interface/xen.h>
#include <xen/features.h>
-#define arch_free_page(_page,_order) \
-({ int foreign = PageForeign(_page); \
- if (foreign) \
- PageForeignDestructor(_page); \
- foreign; \
-})
-#define HAVE_ARCH_FREE_PAGE
-
#ifdef CONFIG_X86_USE_3DNOW
#include <asm/mmx.h>
Index: head-2007-10-15/include/asm-ia64/page.h
===================================================================
--- head-2007-10-15.orig/include/asm-ia64/page.h
+++ head-2007-10-15/include/asm-ia64/page.h
@@ -239,15 +239,6 @@ get_order (unsigned long size)
#include <asm/maddr.h>
-#define arch_free_page(_page, _order) \
-({ \
- int foreign = PageForeign(_page); \
- if (foreign) \
- PageForeignDestructor(_page); \
- foreign; \
-})
-#define HAVE_ARCH_FREE_PAGE
-
#endif /* CONFIG_XEN */
#endif /* __ASSEMBLY__ */
Index: head-2007-10-15/include/asm-powerpc/page.h
===================================================================
--- head-2007-10-15.orig/include/asm-powerpc/page.h
+++ head-2007-10-15/include/asm-powerpc/page.h
@@ -194,15 +194,6 @@ extern int page_is_ram(unsigned long pfn
struct vm_area_struct;
extern const char *arch_vma_name(struct vm_area_struct *vma);
-#define arch_free_page(_page, _order) \
-({ \
- int foreign = PageForeign(_page); \
- if (foreign) \
- PageForeignDestructor(_page); \
- foreign; \
-})
-#define HAVE_ARCH_FREE_PAGE
-
#include <asm-generic/memory_model.h>
#endif /* __ASSEMBLY__ */
Index: head-2007-10-15/include/asm-um/page.h
===================================================================
--- head-2007-10-15.orig/include/asm-um/page.h
+++ head-2007-10-15/include/asm-um/page.h
@@ -114,7 +114,7 @@ extern unsigned long uml_physmem;
extern struct page *arch_validate(struct page *page, gfp_t mask, int order);
#define HAVE_ARCH_VALIDATE
-extern int arch_free_page(struct page *page, int order);
+extern void arch_free_page(struct page *page, int order);
#define HAVE_ARCH_FREE_PAGE
#include <asm-generic/memory_model.h>
Index: head-2007-10-15/include/asm-x86_64/mach-xen/asm/page.h
===================================================================
--- head-2007-10-15.orig/include/asm-x86_64/mach-xen/asm/page.h
+++ head-2007-10-15/include/asm-x86_64/mach-xen/asm/page.h
@@ -16,14 +16,6 @@
*/
#define _PAGE_PRESENT 0x001
-#define arch_free_page(_page,_order) \
-({ int foreign = PageForeign(_page); \
- if (foreign) \
- PageForeignDestructor(_page); \
- foreign; \
-})
-#define HAVE_ARCH_FREE_PAGE
-
/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT 12
#ifdef __ASSEMBLY__
Index: head-2007-10-15/include/linux/gfp.h
===================================================================
--- head-2007-10-15.orig/include/linux/gfp.h
+++ head-2007-10-15/include/linux/gfp.h
@@ -99,11 +99,7 @@ static inline enum zone_type gfp_zone(gf
*/
#ifndef HAVE_ARCH_FREE_PAGE
-/*
- * If arch_free_page returns non-zero then the generic free_page code can
- * immediately bail: the arch-specific function has done all the work.
- */
-static inline int arch_free_page(struct page *page, int order) { return 0; }
+static inline void arch_free_page(struct page *page, int order) { }
#endif
extern struct page *
Index: head-2007-10-15/mm/page_alloc.c
===================================================================
--- head-2007-10-15.orig/mm/page_alloc.c
+++ head-2007-10-15/mm/page_alloc.c
@@ -451,8 +451,13 @@ static void __free_pages_ok(struct page
int i;
int reserved = 0;
- if (arch_free_page(page, order))
- return;
+#ifdef CONFIG_XEN
+ if (PageForeign(page)) {
+ PageForeignDestructor(page);
+ return;
+ }
+#endif
+ arch_free_page(page, order);
if (!PageHighMem(page))
debug_check_no_locks_freed(page_address(page),
PAGE_SIZE<<order);
@@ -730,8 +735,13 @@ static void fastcall free_hot_cold_page(
struct per_cpu_pages *pcp;
unsigned long flags;
- if (arch_free_page(page, 0))
- return;
+#ifdef CONFIG_XEN
+ if (PageForeign(page)) {
+ PageForeignDestructor(page);
+ return;
+ }
+#endif
+ arch_free_page(page, 0);
if (PageAnon(page))
page->mapping = NULL;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|