[PATCH V2 2/4] mm: introduce kvfree_atomic()

From: Lai Jiangshan
Date: Tue Nov 18 2008 - 03:55:05 EST



fdtable and sysipc use vfree() in RCU callback. this patch
introduce vfree_atomic() for them.

Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx>
---
diff --git a/include/linux/mm.h b/include/linux/mm.h
index ff89388..aa7b5ca 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -280,6 +280,7 @@ static inline int is_vmalloc_addr(const void *x)

void *kvmalloc(unsigned long size, gfp_t flags);
void kvfree(void *ptr);
+void kvfree_atomic(void *ptr);

static inline struct page *compound_head(struct page *page)
{
diff --git a/mm/util.c b/mm/util.c
index 66d1a12..ed2d317 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -197,6 +197,15 @@ void kvfree(void *ptr)
}
EXPORT_SYMBOL(kvfree);

+void kvfree_atomic(void *ptr)
+{
+ if (is_vmalloc_addr(ptr))
+ vfree_atomic(ptr);
+ else
+ kfree(ptr);
+}
+EXPORT_SYMBOL(kvfree_atomic);
+
#ifndef HAVE_ARCH_PICK_MMAP_LAYOUT
void arch_pick_mmap_layout(struct mm_struct *mm)
{

--
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/