[PATCH] nommu: Provide is_vmalloc_addr() stub.

From: Paul Mundt
Date: Wed Mar 12 2008 - 03:52:12 EST


Introduced in commit-id 9e2779fa281cfda13ac060753d674bbcaa23367e and
ifdef'ed out for nommu in 8ca3ed87db062201e1fa15b64a9214e193fc3a8a, both
approaches end up breaking the nommu build in different ways. An
impressive feat for a 2-liner.

Current is_vmalloc_addr() users fall in to two camps:

- Determining whether to use vfree()/kfree()
- Whether to do vmlist traversal (only /proc/kcore).

Since we don't support /proc/kcore on nommu, that leaves the
vfree()/kfree() determination use cases. nommu vfree() happens to be a
wrapper to kfree() anyways, so is_vmalloc_addr() can always return 0
and end up with the right behaviour.

Signed-off-by: Paul Mundt <lethal@xxxxxxxxxxxx>

---

include/linux/mm.h | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 3f3ccfe..b695875 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -235,15 +235,22 @@ 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);

-#ifdef CONFIG_MMU
-/* Determine if an address is within the vmalloc range */
+/*
+ * Determine if an address is within the vmalloc range
+ *
+ * On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there
+ * is no special casing required.
+ */
static inline int is_vmalloc_addr(const void *x)
{
+#ifdef CONFIG_MMU
unsigned long addr = (unsigned long)x;

return addr >= VMALLOC_START && addr < VMALLOC_END;
-}
+#else
+ return 0;
#endif
+}

static inline struct page *compound_head(struct page *page)
{
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/