--- include/linux/mm.h | 42 ++++++++++++++++++++++++++++++++++++------ include/linux/vmalloc.h | 12 ------------ 2 files changed, 36 insertions(+), 18 deletions(-) Index: linux-2.6/include/linux/mm.h =================================================================== --- linux-2.6.orig/include/linux/mm.h 2007-09-13 19:00:30.000000000 -0700 +++ linux-2.6/include/linux/mm.h 2007-09-13 19:16:51.000000000 -0700 @@ -313,12 +313,6 @@ static inline void get_page(struct page atomic_inc(&page->_count); } -static inline struct page *virt_to_head_page(const void *x) -{ - struct page *page = virt_to_page(x); - return compound_head(page); -} - /* * Setup the page count before being freed into the page allocator for * the first time (boot or memory hotplug) @@ -1091,6 +1085,42 @@ extern int do_munmap(struct mm_struct *, extern unsigned long do_brk(unsigned long, unsigned long); +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_head_page(const void *x) +{ + struct page *page; + + if (unlikely(is_vmalloc_addr(x))) + page = vmalloc_to_page(x); + else + page = virt_to_page(x); + return compound_head(page); +} + +/* + * Determine address of a compund page that may be virtually + * mapped + */ +static inline void *compound_address(struct page *page) +{ + if (!PageVmalloc(page)) + return page_address(page); + else + return vmalloc_address(page); +} + +unsigned long vmalloc_to_pfn(void *addr); + + /* filemap.c */ extern unsigned long page_unuse(struct page *); extern void truncate_inode_pages(struct address_space *, loff_t); Index: linux-2.6/include/linux/vmalloc.h =================================================================== --- linux-2.6.orig/include/linux/vmalloc.h 2007-09-13 19:03:56.000000000 -0700 +++ linux-2.6/include/linux/vmalloc.h 2007-09-13 19:16:44.000000000 -0700 @@ -22,13 +22,6 @@ struct vm_area_struct; #define IOREMAP_MAX_ORDER (7 + PAGE_SHIFT) /* 128 pages */ #endif -static inline int is_vmalloc_addr(void *x) -{ - unsigned long addr = (unsigned long)x; - - return addr >= VMALLOC_START && addr < VMALLOC_END; -} - struct vm_struct { /* keep next,addr,size together to speedup lookups */ struct vm_struct *next; @@ -88,11 +81,6 @@ extern void unmap_kernel_range(unsigned extern struct vm_struct *alloc_vm_area(size_t size); extern void free_vm_area(struct vm_struct *area); -struct page *vmalloc_to_page(void *addr); -void *vmalloc_address(struct page *); - -unsigned long vmalloc_to_pfn(void *addr); - /* * Internals. Dont't use.. */