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

Lai Jiangshan
2008-11-18T08:55:05Z

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

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
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)
{