--- include/asm-x86/page.h | 3 ++- mm/page_alloc.c | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) Index: linux-2.6.25-rc5-mm1/include/asm-x86/page.h =================================================================== --- linux-2.6.25-rc5-mm1.orig/include/asm-x86/page.h 2008-03-19 20:27:26.210959658 -0700 +++ linux-2.6.25-rc5-mm1/include/asm-x86/page.h 2008-03-19 20:58:57.656218009 -0700 @@ -168,7 +168,8 @@ static inline pteval_t native_pte_val(pt #define __boot_va(x) __va(x) #define __boot_pa(x) __pa(x) -#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) +extern struct page *virt_to_page(const void *kaddr); + #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) Index: linux-2.6.25-rc5-mm1/mm/page_alloc.c =================================================================== --- linux-2.6.25-rc5-mm1.orig/mm/page_alloc.c 2008-03-19 20:41:32.843151650 -0700 +++ linux-2.6.25-rc5-mm1/mm/page_alloc.c 2008-03-19 21:03:48.999610315 -0700 @@ -66,6 +66,13 @@ nodemask_t node_states[NR_NODE_STATES] _ }; EXPORT_SYMBOL(node_states); +struct page *virt_to_page(const void *kaddr) +{ + VM_BUG_ON(kaddr >= (void *)VMALLOC_START && kaddr < (void *)VMALLOC_END); + return pfn_to_page(__pa(kaddr) >> PAGE_SHIFT); +} +EXPORT_SYMBOL(virt_to_page); + unsigned long totalram_pages __read_mostly; unsigned long totalreserve_pages __read_mostly; long nr_swap_pages; @@ -322,6 +329,12 @@ static void __free_vcompound(void *addr) } destroy_compound_page(page, order); pages = vunmap(addr); + + if (!pages) { + printk("__free_vcompound: Cannot unmap vmalloc area %p order=%d\n", + addr, order); + return; + } /* * First page will have zero refcount since it maintains state * for the compound and was decremented before we got here. @@ -370,9 +383,9 @@ static void prep_compound_page(struct pa int i; int nr_pages = 1 << order; + __SetPageHead(page); set_compound_page_dtor(page, free_compound_page); set_compound_order(page, order); - __SetPageHead(page); for (i = 1; i < nr_pages; i++) { struct page *p = compound_nth_page(page, i); @@ -1662,6 +1675,14 @@ static noinline struct page *alloc_vcomp prep_compound_page(pages[0], order); + printk("vcompound alloc order=%d address=%p\n", order, vm->addr); + for (i = 0; i < nr_pages; i++) { + struct page * p = pages[i]; + + printk("Page %d. %p -> %p(phy %p)\n", + i, p, page_address(p), lowmem_page_address(p)); + } + return pages[0]; abort: