summaryrefslogtreecommitdiff
path: root/mm/vmalloc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-21 00:27:05 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-21 00:27:05 +0400
commitb9d7ccf56be1ac77b71a284a1c0e6337f9a7aff0 (patch)
tree6440e1c679e097d0ea23bf879cd30983c5838419 /mm/vmalloc.c
parent9301975ec251bab1ad7cfcb84a688b26187e4e4a (diff)
parent3038edabf48f01421c621cb77a712b446d3a5d67 (diff)
downloadlinux-b9d7ccf56be1ac77b71a284a1c0e6337f9a7aff0.tar.xz
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: x86 ACPI: fix breakage of resume on 64-bit UP systems with SMP kernel Introduce is_vmalloc_or_module_addr() and use with DEBUG_VIRTUAL
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r--mm/vmalloc.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 712ae47af0bf..0797589d51f8 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -175,6 +175,21 @@ static int vmap_page_range(unsigned long addr, unsigned long end,
return nr;
}
+static inline int is_vmalloc_or_module_addr(const void *x)
+{
+ /*
+ * x86-64 and sparc64 put modules in a special place,
+ * and fall back on vmalloc() if that fails. Others
+ * just put it in the vmalloc space.
+ */
+#if defined(CONFIG_MODULES) && defined(MODULES_VADDR)
+ unsigned long addr = (unsigned long)x;
+ if (addr >= MODULES_VADDR && addr < MODULES_END)
+ return 1;
+#endif
+ return is_vmalloc_addr(x);
+}
+
/*
* Walk a vmap address to the struct page it maps.
*/
@@ -188,8 +203,7 @@ struct page *vmalloc_to_page(const void *vmalloc_addr)
* XXX we might need to change this if we add VIRTUAL_BUG_ON for
* architectures that do not vmalloc module space
*/
- VIRTUAL_BUG_ON(!is_vmalloc_addr(vmalloc_addr) &&
- !is_module_address(addr));
+ VIRTUAL_BUG_ON(!is_vmalloc_or_module_addr(vmalloc_addr));
if (!pgd_none(*pgd)) {
pud_t *pud = pud_offset(pgd, addr);