--- include/asm-x86_64/page.h | 2 +- include/linux/mm.h | 28 +++++++++++++++++++--------- 2 files changed, 20 insertions(+), 10 deletions(-) Index: linux-2.6/include/asm-x86_64/page.h =================================================================== --- linux-2.6.orig/include/asm-x86_64/page.h 2007-09-14 12:01:44.000000000 -0700 +++ linux-2.6/include/asm-x86_64/page.h 2007-09-14 12:02:12.000000000 -0700 @@ -125,7 +125,7 @@ extern unsigned long __phys_addr(unsigne #define pfn_valid(pfn) ((pfn) < end_pfn) #endif -#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) +#define __virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) Index: linux-2.6/include/linux/mm.h =================================================================== --- linux-2.6.orig/include/linux/mm.h 2007-09-14 11:25:50.000000000 -0700 +++ linux-2.6/include/linux/mm.h 2007-09-14 12:11:00.000000000 -0700 @@ -313,6 +313,23 @@ static inline void get_page(struct page atomic_inc(&page->_count); } +static inline int is_vmalloc_addr(const void *x) +{ + unsigned long addr = (unsigned long)x; + + return addr >= VMALLOC_START && addr < VMALLOC_END; +} + +struct page *vmalloc_to_page(const void *addr); +void *vmalloc_address(struct page *); + +static inline struct page *virt_to_page(const void *x) +{ + if (is_vmalloc_addr(x)) + return vmalloc_to_page(x); + return __virt_to_page(x); +} + static inline struct page *virt_to_head_page(const void *x) { struct page *page = virt_to_page(x); @@ -584,6 +601,8 @@ static inline void set_page_links(struct static __always_inline void *lowmem_page_address(struct page *page) { + if (PageVmalloc(page)) + return vmalloc_address(page); return __va(page_to_pfn(page) << PAGE_SHIFT); } @@ -1158,17 +1177,8 @@ static inline unsigned long vma_pages(st return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; } -static inline int is_vmalloc_addr(void *x) -{ - unsigned long addr = (unsigned long)x; - - return addr >= VMALLOC_START && addr < VMALLOC_END; -} - pgprot_t vm_get_page_prot(unsigned long vm_flags); struct vm_area_struct *find_extend_vma(struct mm_struct *, unsigned long addr); -struct page *vmalloc_to_page(void *addr); -void *vmalloc_address(struct page *); unsigned long vmalloc_to_pfn(void *addr); int remap_pfn_range(struct vm_area_struct *, unsigned long addr, unsigned long pfn, unsigned long size, pgprot_t);