fork: Move thread info gfp flags to header
authorThomas Gleixner <tglx@linutronix.de>
Sat, 5 May 2012 15:05:41 +0000 (15:05 +0000)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 8 May 2012 11:55:20 +0000 (13:55 +0200)
These flags can be useful for extra allocations outside of the core
code.

Add __GFP_NOTRACK to them, so the archs which have kmemcheck do
not have to provide extra allocators just for that reason.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20120505150141.428211694@linutronix.de
include/linux/thread_info.h
kernel/fork.c

index 8d03f079688cfdd41da394aa5e09ee9ae036cb80..db78775eff3b209b534d157d4cec7d90eec8b175 100644 (file)
@@ -54,6 +54,12 @@ extern long do_no_restart_syscall(struct restart_block *parm);
 
 #ifdef __KERNEL__
 
+#ifdef CONFIG_DEBUG_STACK_USAGE
+# define THREADINFO_GFP                (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO)
+#else
+# define THREADINFO_GFP                (GFP_KERNEL | __GFP_NOTRACK)
+#endif
+
 /*
  * flag set/clear/test wrappers
  * - pass TIF_xxxx constants to these functions
index a79b36e2e912089a4d2bf2dd7393667cbcfd2f16..5d22b9b8cf7b5f156ace2de279ff4a6ee6f9b133 100644 (file)
@@ -123,12 +123,8 @@ static struct kmem_cache *task_struct_cachep;
 static struct thread_info *alloc_thread_info_node(struct task_struct *tsk,
                                                  int node)
 {
-#ifdef CONFIG_DEBUG_STACK_USAGE
-       gfp_t mask = GFP_KERNEL | __GFP_ZERO;
-#else
-       gfp_t mask = GFP_KERNEL;
-#endif
-       struct page *page = alloc_pages_node(node, mask, THREAD_SIZE_ORDER);
+       struct page *page = alloc_pages_node(node, THREADINFO_GFP,
+                                            THREAD_SIZE_ORDER);
 
        return page ? page_address(page) : NULL;
 }