[PATCH 1/4] convert task_struct allocator macros to inlinefunctions

From: Akinobu Mita
Date: Sat Dec 27 2008 - 00:17:29 EST


Usually inline function is better than function-like macro.

Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
Signed-off-by: Akinobu Mita <akinobu.mita@xxxxxxxxx>
---
kernel/fork.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

Index: 2.6/kernel/fork.c
===================================================================
--- 2.6.orig/kernel/fork.c
+++ 2.6/kernel/fork.c
@@ -92,9 +92,19 @@ int nr_processes(void)
}

#ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
-# define alloc_task_struct() kmem_cache_alloc(task_struct_cachep, GFP_KERNEL)
-# define free_task_struct(tsk) kmem_cache_free(task_struct_cachep, (tsk))
+
static struct kmem_cache *task_struct_cachep;
+
+static inline struct task_struct *alloc_task_struct(void)
+{
+ return kmem_cache_alloc(task_struct_cachep, GFP_KERNEL);
+}
+
+static inline void free_task_struct(struct task_struct *tsk)
+{
+ kmem_cache_free(task_struct_cachep, tsk);
+}
+
#endif

#ifndef __HAVE_ARCH_THREAD_INFO_ALLOCATOR
--
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/