is_vmalloc_addr(): Check if an address is within the vmalloc boundaries

Checking if an address is a vmalloc address is done in a couple of places.
Define a common version in mm.h and replace the other checks.

Again the include structures suck.  The definition of VMALLOC_START and
VMALLOC_END is not available in vmalloc.h since highmem.c cannot be included
there.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Christoph Lameter
2008-02-04 22:28:34 -08:00
committed by Linus Torvalds
parent 0b7a96114b
commit 9e2779fa28
7 changed files with 14 additions and 19 deletions

View File

@@ -235,6 +235,14 @@ static inline int get_page_unless_zero(struct page *page)
struct page *vmalloc_to_page(const void *addr);
unsigned long vmalloc_to_pfn(const void *addr);
/* Determine if an address is within the vmalloc range */
static inline int is_vmalloc_addr(const void *x)
{
unsigned long addr = (unsigned long)x;
return addr >= VMALLOC_START && addr < VMALLOC_END;
}
static inline struct page *compound_head(struct page *page)
{
if (unlikely(PageTail(page)))