linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 01/18] fork: Remove the weak insanity
  2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
@ 2012-05-05 15:05 ` Thomas Gleixner
  2012-05-05 15:58   ` Sam Ravnborg
  2012-05-08 12:31   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  2012-05-05 15:05 ` [patch 03/18] fork: Move thread info gfp flags to header Thomas Gleixner
                   ` (16 subsequent siblings)
  17 siblings, 2 replies; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML

[-- Attachment #1: fork-remove-the-weak-insanity.patch --]
[-- Type: text/plain, Size: 2128 bytes --]

We error out when compiling with gcc4.1.[01] as it miscompiles
__weak. The workaround with magic defines is not longer
necessary. Make it __weak again.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/sh/include/asm/thread_info.h  |    1 -
 arch/x86/include/asm/thread_info.h |    1 -
 kernel/fork.c                      |    8 +-------
 3 files changed, 1 insertion(+), 9 deletions(-)

Index: tip/arch/sh/include/asm/thread_info.h
===================================================================
--- tip.orig/arch/sh/include/asm/thread_info.h
+++ tip/arch/sh/include/asm/thread_info.h
@@ -98,7 +98,6 @@ static inline struct thread_info *curren
 extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node);
 extern void free_thread_info(struct thread_info *ti);
 extern void arch_task_cache_init(void);
-#define arch_task_cache_init arch_task_cache_init
 extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
 extern void init_thread_xstate(void);
 
Index: tip/arch/x86/include/asm/thread_info.h
===================================================================
--- tip.orig/arch/x86/include/asm/thread_info.h
+++ tip/arch/x86/include/asm/thread_info.h
@@ -284,6 +284,5 @@ static inline bool is_ia32_task(void)
 extern void arch_task_cache_init(void);
 extern void free_thread_info(struct thread_info *ti);
 extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
-#define arch_task_cache_init arch_task_cache_init
 #endif
 #endif /* _ASM_X86_THREAD_INFO_H */
Index: tip/kernel/fork.c
===================================================================
--- tip.orig/kernel/fork.c
+++ tip/kernel/fork.c
@@ -203,13 +203,7 @@ void __put_task_struct(struct task_struc
 }
 EXPORT_SYMBOL_GPL(__put_task_struct);
 
-/*
- * macro override instead of weak attribute alias, to workaround
- * gcc 4.1.0 and 4.1.1 bugs with weak attribute and empty functions.
- */
-#ifndef arch_task_cache_init
-#define arch_task_cache_init()
-#endif
+void __init __weak arch_task_cache_init(void) { }
 
 void __init fork_init(unsigned long mempages)
 {



^ permalink raw reply	[flat|nested] 57+ messages in thread

* [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators
@ 2012-05-05 15:05 Thomas Gleixner
  2012-05-05 15:05 ` [patch 01/18] fork: Remove the weak insanity Thomas Gleixner
                   ` (17 more replies)
  0 siblings, 18 replies; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML

We have a lot of duplicate implementations of the threadinfo and task
struct allocator around in arch/*. This series consolidates them.

Applies on top of 

 git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git smp/hotplug

Thanks,

	tglx
---
 arch/Kconfig                            |    8 +++
 arch/c6x/include/asm/thread_info.h      |   17 -------
 arch/cris/include/asm/processor.h       |    5 --
 arch/cris/include/asm/thread_info.h     |    6 --
 arch/frv/include/asm/thread_info.h      |   13 ------
 arch/hexagon/include/asm/thread_info.h  |    8 ---
 arch/hexagon/kernel/process.c           |   37 -----------------
 arch/ia64/Kconfig                       |    2 
 arch/ia64/include/asm/thread_info.h     |    3 -
 arch/m32r/include/asm/thread_info.h     |   17 -------
 arch/mips/include/asm/thread_info.h     |   12 -----
 arch/mn10300/include/asm/thread_info.h  |   17 +------
 arch/mn10300/kernel/kgdb.c              |    3 -
 arch/powerpc/include/asm/thread_info.h  |   13 ------
 arch/powerpc/kernel/process.c           |   31 --------------
 arch/score/include/asm/thread_info.h    |   10 +---
 arch/sh/include/asm/thread_info.h       |   11 -----
 arch/sh/kernel/process.c                |   46 ---------------------
 arch/sparc/Kconfig                      |    1 
 arch/sparc/include/asm/thread_info_32.h |    2 
 arch/sparc/include/asm/thread_info_64.h |   25 -----------
 arch/tile/include/asm/thread_info.h     |    6 --
 arch/tile/kernel/process.c              |   23 ----------
 arch/x86/include/asm/boot.h             |    2 
 arch/x86/include/asm/page_32_types.h    |    4 -
 arch/x86/include/asm/page_64_types.h    |    4 -
 arch/x86/include/asm/thread_info.h      |   21 ---------
 arch/x86/kernel/irq_32.c                |    8 +--
 arch/x86/kernel/process.c               |    5 --
 include/linux/thread_info.h             |    6 ++
 kernel/fork.c                           |   69 ++++++++++++++++++++++----------
 31 files changed, 100 insertions(+), 335 deletions(-)




^ permalink raw reply	[flat|nested] 57+ messages in thread

* [patch 03/18] fork: Move thread info gfp flags to header
  2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
  2012-05-05 15:05 ` [patch 01/18] fork: Remove the weak insanity Thomas Gleixner
@ 2012-05-05 15:05 ` Thomas Gleixner
  2012-05-07  4:34   ` Paul E. McKenney
  2012-05-08 12:32   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  2012-05-05 15:05 ` [patch 04/18] fork: Provide kmemcache based thread_info allocator Thomas Gleixner
                   ` (15 subsequent siblings)
  17 siblings, 2 replies; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML

[-- Attachment #1: fork-move-thread-info-gfp-flags-to-header.patch --]
[-- Type: text/plain, Size: 1550 bytes --]

These flags can be useful for extra allocations outside of the core
code.

Add __GFP_NOTRACE 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>
---
 include/linux/thread_info.h |    6 ++++++
 kernel/fork.c               |    8 ++------
 2 files changed, 8 insertions(+), 6 deletions(-)

Index: tip/include/linux/thread_info.h
===================================================================
--- tip.orig/include/linux/thread_info.h
+++ tip/include/linux/thread_info.h
@@ -54,6 +54,12 @@ extern long do_no_restart_syscall(struct
 
 #ifdef __KERNEL__
 
+#ifdef CONFIG_DEBUG_STACK_USAGE
+# define THREADINFO_GFP		(GFP_KERNEL | __GFP_NOTRACE | __GFP_ZERO)
+#else
+# define THREADINFO_GFP		(GFP_KERNEL | __GFP_NOTRACE)
+#endif
+
 /*
  * flag set/clear/test wrappers
  * - pass TIF_xxxx constants to these functions
Index: tip/kernel/fork.c
===================================================================
--- tip.orig/kernel/fork.c
+++ tip/kernel/fork.c
@@ -135,12 +135,8 @@ void __weak arch_release_thread_info(str
 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;
 }



^ permalink raw reply	[flat|nested] 57+ messages in thread

* [patch 04/18] fork: Provide kmemcache based thread_info allocator
  2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
  2012-05-05 15:05 ` [patch 01/18] fork: Remove the weak insanity Thomas Gleixner
  2012-05-05 15:05 ` [patch 03/18] fork: Move thread info gfp flags to header Thomas Gleixner
@ 2012-05-05 15:05 ` Thomas Gleixner
  2012-05-08 12:35   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  2012-05-05 15:05 ` [patch 02/18] fork: Provide weak arch_release_[task_struct|thread_info] functions Thomas Gleixner
                   ` (14 subsequent siblings)
  17 siblings, 1 reply; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML

[-- Attachment #1: fork-provide-kmemcache-based-thread-info-allocator.patch --]
[-- Type: text/plain, Size: 1644 bytes --]

Several architectures have their own kmemcache based thread allocator
because THREAD_SIZE is smaller than PAGE_SIZE. Add it to the core code
conditionally on THREAD_SIZE < PAGE_SIZE so the private copies can go.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/fork.c |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Index: tip/kernel/fork.c
===================================================================
--- tip.orig/kernel/fork.c
+++ tip/kernel/fork.c
@@ -132,6 +132,11 @@ static inline void free_task_struct(stru
 
 void __weak arch_release_thread_info(struct thread_info *ti) { }
 
+/*
+ * Allocate pages if THREAD_SIZE is >= PAGE_SIZE, otherwise use a
+ * kmemcache based allocator.
+ */
+# if THREAD_SIZE >= PAGE_SIZE
 static struct thread_info *alloc_thread_info_node(struct task_struct *tsk,
 						  int node)
 {
@@ -146,6 +151,28 @@ static inline void free_thread_info(stru
 	arch_release_thread_info(ti);
 	free_pages((unsigned long)ti, THREAD_SIZE_ORDER);
 }
+# else
+static struct kmem_cache *thread_info_cache;
+
+static struct thread_info *alloc_thread_info_node(struct task_struct *tsk,
+						  int node)
+{
+	return kmem_cache_alloc_node(thread_info_cache, THREADINFO_GFP, node);
+}
+
+static void free_thread_info(struct thread_info *ti)
+{
+	arch_release_thread_info(ti);
+	kmem_cache_free(thread_info_cache, ti);
+}
+
+void thread_info_cache_init(void)
+{
+	thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE,
+					      THREAD_SIZE, 0, NULL);
+	BUG_ON(thread_info_cache == NULL);
+}
+# endif
 #endif
 
 /* SLAB cache for signal_struct structures (tsk->signal) */



^ permalink raw reply	[flat|nested] 57+ messages in thread

* [patch 02/18] fork: Provide weak arch_release_[task_struct|thread_info] functions
  2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
                   ` (2 preceding siblings ...)
  2012-05-05 15:05 ` [patch 04/18] fork: Provide kmemcache based thread_info allocator Thomas Gleixner
@ 2012-05-05 15:05 ` Thomas Gleixner
  2012-05-08 12:33   ` [tip:smp/hotplug] fork: Provide weak arch_release_[ task_struct|thread_info] functions tip-bot for Thomas Gleixner
  2012-05-05 15:05 ` [patch 05/18] x86: Use common threadinfo allocator Thomas Gleixner
                   ` (13 subsequent siblings)
  17 siblings, 1 reply; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML

[-- Attachment #1: fork-provide-arch-release-task-struct.patch --]
[-- Type: text/plain, Size: 1525 bytes --]

These functions allow us to move most of the duplicated thread_info
allocators to the core code.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/fork.c |   21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

Index: tip/kernel/fork.c
===================================================================
--- tip.orig/kernel/fork.c
+++ tip/kernel/fork.c
@@ -112,14 +112,26 @@ int nr_processes(void)
 }
 
 #ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
-# define alloc_task_struct_node(node)		\
-		kmem_cache_alloc_node(task_struct_cachep, GFP_KERNEL, node)
-# 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_node(int node)
+{
+	return kmem_cache_alloc_node(task_struct_cachep, GFP_KERNEL, node);
+}
+
+void __weak arch_release_task_struct(struct task_struct *tsk) { }
+
+static inline void free_task_struct(struct task_struct *tsk)
+{
+	arch_release_task_struct(tsk);
+	kmem_cache_free(task_struct_cachep, tsk);
+}
 #endif
 
 #ifndef __HAVE_ARCH_THREAD_INFO_ALLOCATOR
+
+void __weak arch_release_thread_info(struct thread_info *ti) { }
+
 static struct thread_info *alloc_thread_info_node(struct task_struct *tsk,
 						  int node)
 {
@@ -135,6 +147,7 @@ static struct thread_info *alloc_thread_
 
 static inline void free_thread_info(struct thread_info *ti)
 {
+	arch_release_thread_info(ti);
 	free_pages((unsigned long)ti, THREAD_SIZE_ORDER);
 }
 #endif



^ permalink raw reply	[flat|nested] 57+ messages in thread

* [patch 06/18] c6x: Use common threadinfo allocator
  2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
                   ` (4 preceding siblings ...)
  2012-05-05 15:05 ` [patch 05/18] x86: Use common threadinfo allocator Thomas Gleixner
@ 2012-05-05 15:05 ` Thomas Gleixner
  2012-05-07 19:49   ` Mark Salter
  2012-05-08 12:36   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  2012-05-05 15:05 ` [patch 08/18] frv: " Thomas Gleixner
                   ` (11 subsequent siblings)
  17 siblings, 2 replies; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML; +Cc: Mark Salter

[-- Attachment #1: c6x-use-common-threadinfo-allocator.patch --]
[-- Type: text/plain, Size: 1483 bytes --]

There is no functional difference. __get_free_pages() ends up calling
alloc_pages_node().

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Mark Salter <msalter@redhat.com>
---
 arch/c6x/include/asm/thread_info.h |   17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

Index: tip/arch/c6x/include/asm/thread_info.h
===================================================================
--- tip.orig/arch/c6x/include/asm/thread_info.h
+++ tip/arch/c6x/include/asm/thread_info.h
@@ -20,11 +20,11 @@
 #ifdef CONFIG_4KSTACKS
 #define THREAD_SIZE		4096
 #define THREAD_SHIFT		12
-#define THREAD_ORDER		0
+#define THREAD_SIZE_ORDER	0
 #else
 #define THREAD_SIZE		8192
 #define THREAD_SHIFT		13
-#define THREAD_ORDER		1
+#define THREAD_SIZE_ORDER	1
 #endif
 
 #define THREAD_START_SP		(THREAD_SIZE - 8)
@@ -80,19 +80,6 @@ struct thread_info *current_thread_info(
 	return ti;
 }
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
-/* thread information allocation */
-#ifdef CONFIG_DEBUG_STACK_USAGE
-#define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO)
-#else
-#define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK)
-#endif
-
-#define alloc_thread_info_node(tsk, node)	\
-	((struct thread_info *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER))
-
-#define free_thread_info(ti)	free_pages((unsigned long) (ti), THREAD_ORDER)
 #define get_thread_info(ti)	get_task_struct((ti)->task)
 #define put_thread_info(ti)	put_task_struct((ti)->task)
 #endif /* __ASSEMBLY__ */



^ permalink raw reply	[flat|nested] 57+ messages in thread

* [patch 05/18] x86: Use common threadinfo allocator
  2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
                   ` (3 preceding siblings ...)
  2012-05-05 15:05 ` [patch 02/18] fork: Provide weak arch_release_[task_struct|thread_info] functions Thomas Gleixner
@ 2012-05-05 15:05 ` Thomas Gleixner
  2012-05-08 12:37   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  2012-05-05 15:05 ` [patch 06/18] c6x: " Thomas Gleixner
                   ` (12 subsequent siblings)
  17 siblings, 1 reply; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML; +Cc: x86

[-- Attachment #1: x86-use-common-threadinfo-allocator.patch --]
[-- Type: text/plain, Size: 4820 bytes --]

The only difference is the free_thread_info function, which frees
xstate.

Use the new arch_release_task_struct() function instead and switch
over to the core allocator.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: x86@kernel.org
---
 arch/x86/include/asm/boot.h          |    2 +-
 arch/x86/include/asm/page_32_types.h |    4 ++--
 arch/x86/include/asm/page_64_types.h |    4 ++--
 arch/x86/include/asm/thread_info.h   |   20 +-------------------
 arch/x86/kernel/irq_32.c             |    8 ++++----
 arch/x86/kernel/process.c            |    5 ++---
 6 files changed, 12 insertions(+), 31 deletions(-)

Index: tip/arch/x86/include/asm/boot.h
===================================================================
--- tip.orig/arch/x86/include/asm/boot.h
+++ tip/arch/x86/include/asm/boot.h
@@ -19,7 +19,7 @@
 #ifdef CONFIG_X86_64
 #define MIN_KERNEL_ALIGN_LG2	PMD_SHIFT
 #else
-#define MIN_KERNEL_ALIGN_LG2	(PAGE_SHIFT + THREAD_ORDER)
+#define MIN_KERNEL_ALIGN_LG2	(PAGE_SHIFT + THREAD_SIZE_ORDER)
 #endif
 #define MIN_KERNEL_ALIGN	(_AC(1, UL) << MIN_KERNEL_ALIGN_LG2)
 
Index: tip/arch/x86/include/asm/page_32_types.h
===================================================================
--- tip.orig/arch/x86/include/asm/page_32_types.h
+++ tip/arch/x86/include/asm/page_32_types.h
@@ -15,8 +15,8 @@
  */
 #define __PAGE_OFFSET		_AC(CONFIG_PAGE_OFFSET, UL)
 
-#define THREAD_ORDER	1
-#define THREAD_SIZE 	(PAGE_SIZE << THREAD_ORDER)
+#define THREAD_SIZE_ORDER	1
+#define THREAD_SIZE		(PAGE_SIZE << THREAD_SIZE_ORDER)
 
 #define STACKFAULT_STACK 0
 #define DOUBLEFAULT_STACK 1
Index: tip/arch/x86/include/asm/page_64_types.h
===================================================================
--- tip.orig/arch/x86/include/asm/page_64_types.h
+++ tip/arch/x86/include/asm/page_64_types.h
@@ -1,8 +1,8 @@
 #ifndef _ASM_X86_PAGE_64_DEFS_H
 #define _ASM_X86_PAGE_64_DEFS_H
 
-#define THREAD_ORDER	1
-#define THREAD_SIZE  (PAGE_SIZE << THREAD_ORDER)
+#define THREAD_SIZE_ORDER	1
+#define THREAD_SIZE  (PAGE_SIZE << THREAD_SIZE_ORDER)
 #define CURRENT_MASK (~(THREAD_SIZE - 1))
 
 #define EXCEPTION_STACK_ORDER 0
Index: tip/arch/x86/include/asm/thread_info.h
===================================================================
--- tip.orig/arch/x86/include/asm/thread_info.h
+++ tip/arch/x86/include/asm/thread_info.h
@@ -155,24 +155,6 @@ struct thread_info {
 
 #define PREEMPT_ACTIVE		0x10000000
 
-/* thread information allocation */
-#ifdef CONFIG_DEBUG_STACK_USAGE
-#define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO)
-#else
-#define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK)
-#endif
-
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
-#define alloc_thread_info_node(tsk, node)				\
-({									\
-	struct page *page = alloc_pages_node(node, THREAD_FLAGS,	\
-					     THREAD_ORDER);		\
-	struct thread_info *ret = page ? page_address(page) : NULL;	\
-									\
-	ret;								\
-})
-
 #ifdef CONFIG_X86_32
 
 #define STACK_WARN	(THREAD_SIZE/8)
@@ -282,7 +264,7 @@ static inline bool is_ia32_task(void)
 
 #ifndef __ASSEMBLY__
 extern void arch_task_cache_init(void);
-extern void free_thread_info(struct thread_info *ti);
 extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
+extern void arch_release_task_struct(struct task_struct *tsk);
 #endif
 #endif /* _ASM_X86_THREAD_INFO_H */
Index: tip/arch/x86/kernel/irq_32.c
===================================================================
--- tip.orig/arch/x86/kernel/irq_32.c
+++ tip/arch/x86/kernel/irq_32.c
@@ -127,8 +127,8 @@ void __cpuinit irq_ctx_init(int cpu)
 		return;
 
 	irqctx = page_address(alloc_pages_node(cpu_to_node(cpu),
-					       THREAD_FLAGS,
-					       THREAD_ORDER));
+					       THREADINFO_GFP,
+					       THREAD_SIZE_ORDER));
 	memset(&irqctx->tinfo, 0, sizeof(struct thread_info));
 	irqctx->tinfo.cpu		= cpu;
 	irqctx->tinfo.preempt_count	= HARDIRQ_OFFSET;
@@ -137,8 +137,8 @@ void __cpuinit irq_ctx_init(int cpu)
 	per_cpu(hardirq_ctx, cpu) = irqctx;
 
 	irqctx = page_address(alloc_pages_node(cpu_to_node(cpu),
-					       THREAD_FLAGS,
-					       THREAD_ORDER));
+					       THREADINFO_GFP,
+					       THREAD_SIZE_ORDER));
 	memset(&irqctx->tinfo, 0, sizeof(struct thread_info));
 	irqctx->tinfo.cpu		= cpu;
 	irqctx->tinfo.addr_limit	= MAKE_MM_SEG(0);
Index: tip/arch/x86/kernel/process.c
===================================================================
--- tip.orig/arch/x86/kernel/process.c
+++ tip/arch/x86/kernel/process.c
@@ -76,10 +76,9 @@ void free_thread_xstate(struct task_stru
 	fpu_free(&tsk->thread.fpu);
 }
 
-void free_thread_info(struct thread_info *ti)
+void arch_release_task_struct(struct task_struct *tsk)
 {
-	free_thread_xstate(ti->task);
-	free_pages((unsigned long)ti, THREAD_ORDER);
+	free_thread_xstate(tsk);
 }
 
 void arch_task_cache_init(void)



^ permalink raw reply	[flat|nested] 57+ messages in thread

* [patch 07/18] cris: Use common threadinfo allocator
  2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
                   ` (6 preceding siblings ...)
  2012-05-05 15:05 ` [patch 08/18] frv: " Thomas Gleixner
@ 2012-05-05 15:05 ` Thomas Gleixner
  2012-05-08 12:37   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  2012-05-15 12:49   ` [patch 07/18] " Jesper Nilsson
  2012-05-05 15:05 ` [patch 09/18] hexagon: " Thomas Gleixner
                   ` (9 subsequent siblings)
  17 siblings, 2 replies; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML; +Cc: Jesper Nilsson

[-- Attachment #1: cris-use-common-threadinfo-allocator.patch --]
[-- Type: text/plain, Size: 1829 bytes --]

There is no functional difference. __get_free_pages() ends up calling
alloc_pages_node().

This also allocates only one page which matches THREAD_SIZE instead of
an extra page for nothing.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
---
 arch/cris/include/asm/processor.h   |    5 ++---
 arch/cris/include/asm/thread_info.h |    6 ------
 2 files changed, 2 insertions(+), 9 deletions(-)

Index: tip/arch/cris/include/asm/processor.h
===================================================================
--- tip.orig/arch/cris/include/asm/processor.h
+++ tip/arch/cris/include/asm/processor.h
@@ -25,13 +25,12 @@ struct task_struct;
  */
 #define TASK_UNMAPPED_BASE      (PAGE_ALIGN(TASK_SIZE / 3))
 
-/* THREAD_SIZE is the size of the task_struct/kernel_stack combo.
+/* THREAD_SIZE is the size of the thread_info/kernel_stack combo.
  * normally, the stack is found by doing something like p + THREAD_SIZE
  * in CRIS, a page is 8192 bytes, which seems like a sane size
  */
-
 #define THREAD_SIZE       PAGE_SIZE
-#define KERNEL_STACK_SIZE PAGE_SIZE
+#define THREAD_SIZE_ORDER (0)
 
 /*
  * At user->kernel entry, the pt_regs struct is stacked on the top of the kernel-stack.
Index: tip/arch/cris/include/asm/thread_info.h
===================================================================
--- tip.orig/arch/cris/include/asm/thread_info.h
+++ tip/arch/cris/include/asm/thread_info.h
@@ -65,12 +65,6 @@ struct thread_info {
 
 #define init_thread_info	(init_thread_union.thread_info)
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-/* thread information allocation */
-#define alloc_thread_info_node(tsk, node)	\
-	((struct thread_info *) __get_free_pages(GFP_KERNEL, 1))
-#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
-
 #endif /* !__ASSEMBLY__ */
 
 /*



^ permalink raw reply	[flat|nested] 57+ messages in thread

* [patch 08/18] frv: Use common threadinfo allocator
  2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
                   ` (5 preceding siblings ...)
  2012-05-05 15:05 ` [patch 06/18] c6x: " Thomas Gleixner
@ 2012-05-05 15:05 ` Thomas Gleixner
  2012-05-08 12:38   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  2012-05-05 15:05 ` [patch 07/18] cris: " Thomas Gleixner
                   ` (10 subsequent siblings)
  17 siblings, 1 reply; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML; +Cc: David Howells

[-- Attachment #1: frv-use-common-threadinfo-allocator.patch --]
[-- Type: text/plain, Size: 1011 bytes --]

The core now has a threadinfo allocator which uses a kmemcache when
THREAD_SIZE < PAGE_SIZE.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: David Howells <dhowells@redhat.com>
---
 arch/frv/include/asm/thread_info.h |   13 -------------
 1 file changed, 13 deletions(-)

Index: tip/arch/frv/include/asm/thread_info.h
===================================================================
--- tip.orig/arch/frv/include/asm/thread_info.h
+++ tip/arch/frv/include/asm/thread_info.h
@@ -80,19 +80,6 @@ register struct thread_info *__current_t
 
 #define current_thread_info() ({ __current_thread_info; })
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
-/* thread information allocation */
-#ifdef CONFIG_DEBUG_STACK_USAGE
-#define alloc_thread_info_node(tsk, node)			\
-		kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
-#else
-#define alloc_thread_info_node(tsk, node)			\
-		kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
-#endif
-
-#define free_thread_info(info)	kfree(info)
-
 #endif /* __ASSEMBLY__ */
 
 /*



^ permalink raw reply	[flat|nested] 57+ messages in thread

* [patch 10/18] m32r: Use common threadinfo allocator
  2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
                   ` (8 preceding siblings ...)
  2012-05-05 15:05 ` [patch 09/18] hexagon: " Thomas Gleixner
@ 2012-05-05 15:05 ` Thomas Gleixner
  2012-05-08 12:39   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  2012-05-05 15:05 ` [patch 11/18] mips: " Thomas Gleixner
                   ` (7 subsequent siblings)
  17 siblings, 1 reply; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML; +Cc: Hirokazu Takata

[-- Attachment #1: m32r-use-common-threadinfo-allocator.patch --]
[-- Type: text/plain, Size: 1336 bytes --]

No reason why m32r needs to use kmalloc to allocate 2 pages instead of
using the core allocator.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Hirokazu Takata <takata@linux-m32r.org>
---
 arch/m32r/include/asm/thread_info.h |   17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

Index: tip/arch/m32r/include/asm/thread_info.h
===================================================================
--- tip.orig/arch/m32r/include/asm/thread_info.h
+++ tip/arch/m32r/include/asm/thread_info.h
@@ -55,8 +55,8 @@ struct thread_info {
 
 #define PREEMPT_ACTIVE		0x10000000
 
-#define THREAD_SIZE (PAGE_SIZE << 1)
-
+#define THREAD_SIZE		(PAGE_SIZE << 1)
+#define THREAD_SIZE_ORDER	1
 /*
  * macros/functions for gaining access to the thread information structure
  */
@@ -92,19 +92,6 @@ static inline struct thread_info *curren
 	return ti;
 }
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
-/* thread information allocation */
-#ifdef CONFIG_DEBUG_STACK_USAGE
-#define alloc_thread_info_node(tsk, node)			\
-		kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
-#else
-#define alloc_thread_info_node(tsk, node)			\
-		kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
-#endif
-
-#define free_thread_info(info) kfree(info)
-
 #define TI_FLAG_FAULT_CODE_SHIFT	28
 
 static inline void set_thread_fault_code(unsigned int val)



^ permalink raw reply	[flat|nested] 57+ messages in thread

* [patch 09/18] hexagon: Use common threadinfo allocator
  2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
                   ` (7 preceding siblings ...)
  2012-05-05 15:05 ` [patch 07/18] cris: " Thomas Gleixner
@ 2012-05-05 15:05 ` Thomas Gleixner
  2012-05-08 12:40   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  2012-05-05 15:05 ` [patch 10/18] m32r: " Thomas Gleixner
                   ` (8 subsequent siblings)
  17 siblings, 1 reply; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML; +Cc: Richard Kuo

[-- Attachment #1: hexagon-use-common-threadinfo-allocator.patch --]
[-- Type: text/plain, Size: 2244 bytes --]

The core now has a threadinfo allocator which uses a kmemcache when
THREAD_SIZE < PAGE_SIZE.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Richard Kuo <rkuo@codeaurora.org>
---
 arch/hexagon/include/asm/thread_info.h |    8 -------
 arch/hexagon/kernel/process.c          |   37 ---------------------------------
 2 files changed, 45 deletions(-)

Index: tip/arch/hexagon/include/asm/thread_info.h
===================================================================
--- tip.orig/arch/hexagon/include/asm/thread_info.h
+++ tip/arch/hexagon/include/asm/thread_info.h
@@ -31,15 +31,7 @@
 
 #define THREAD_SHIFT		12
 #define THREAD_SIZE		(1<<THREAD_SHIFT)
-
-#if THREAD_SHIFT >= PAGE_SHIFT
 #define THREAD_SIZE_ORDER	(THREAD_SHIFT - PAGE_SHIFT)
-#else  /*  don't use standard allocator  */
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node);
-extern void free_thread_info(struct thread_info *ti);
-#endif
-
 
 #ifndef __ASSEMBLY__
 
Index: tip/arch/hexagon/kernel/process.c
===================================================================
--- tip.orig/arch/hexagon/kernel/process.c
+++ tip/arch/hexagon/kernel/process.c
@@ -234,43 +234,6 @@ unsigned long get_wchan(struct task_stru
 }
 
 /*
- * Borrowed from PowerPC -- basically allow smaller kernel stacks if we
- * go crazy with the page sizes.
- */
-#if THREAD_SHIFT < PAGE_SHIFT
-
-static struct kmem_cache *thread_info_cache;
-
-struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node)
-{
-	struct thread_info *ti;
-
-	ti = kmem_cache_alloc_node(thread_info_cache, GFP_KERNEL, node);
-	if (unlikely(ti == NULL))
-		return NULL;
-#ifdef CONFIG_DEBUG_STACK_USAGE
-	memset(ti, 0, THREAD_SIZE);
-#endif
-	return ti;
-}
-
-void free_thread_info(struct thread_info *ti)
-{
-	kmem_cache_free(thread_info_cache, ti);
-}
-
-/*  Weak symbol; called by init/main.c  */
-
-void thread_info_cache_init(void)
-{
-	thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE,
-					      THREAD_SIZE, 0, NULL);
-	BUG_ON(thread_info_cache == NULL);
-}
-
-#endif /* THREAD_SHIFT < PAGE_SHIFT */
-
-/*
  * Required placeholder.
  */
 int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)



^ permalink raw reply	[flat|nested] 57+ messages in thread

* [patch 11/18] mips: Use common threadinfo allocator
  2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
                   ` (9 preceding siblings ...)
  2012-05-05 15:05 ` [patch 10/18] m32r: " Thomas Gleixner
@ 2012-05-05 15:05 ` Thomas Gleixner
  2012-05-08 12:41   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  2012-05-05 15:05 ` [patch 12/18] mn10300: " Thomas Gleixner
                   ` (6 subsequent siblings)
  17 siblings, 1 reply; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML; +Cc: Ralf Baechle

[-- Attachment #1: mips-use-common-threadinfo-allocator.patch --]
[-- Type: text/plain, Size: 966 bytes --]

No point in using kmalloc for allocating 0, 1 resp. 2 pages for
threadinfo.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ralf Baechle <ralf@linux-mips.org>
---
 arch/mips/include/asm/thread_info.h |   12 ------------
 1 file changed, 12 deletions(-)

Index: tip/arch/mips/include/asm/thread_info.h
===================================================================
--- tip.orig/arch/mips/include/asm/thread_info.h
+++ tip/arch/mips/include/asm/thread_info.h
@@ -85,18 +85,6 @@ register struct thread_info *__current_t
 
 #define STACK_WARN	(THREAD_SIZE / 8)
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
-#ifdef CONFIG_DEBUG_STACK_USAGE
-#define alloc_thread_info_node(tsk, node) \
-		kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
-#else
-#define alloc_thread_info_node(tsk, node) \
-		kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
-#endif
-
-#define free_thread_info(info) kfree(info)
-
 #endif /* !__ASSEMBLY__ */
 
 #define PREEMPT_ACTIVE		0x10000000



^ permalink raw reply	[flat|nested] 57+ messages in thread

* [patch 13/18] powerpc: Use common threadinfo allocator
  2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
                   ` (11 preceding siblings ...)
  2012-05-05 15:05 ` [patch 12/18] mn10300: " Thomas Gleixner
@ 2012-05-05 15:05 ` Thomas Gleixner
  2012-05-08 12:42   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  2012-05-05 15:05 ` [patch 14/18] score: " Thomas Gleixner
                   ` (4 subsequent siblings)
  17 siblings, 1 reply; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML; +Cc: Benjamin Herrenschmidt

[-- Attachment #1: powerpc-use-common-threadinfo-allocator.patch --]
[-- Type: text/plain, Size: 2382 bytes --]

The core now has a threadinfo allocator which uses a kmemcache when
THREAD_SIZE < PAGE_SIZE.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/powerpc/include/asm/thread_info.h |   13 -------------
 arch/powerpc/kernel/process.c          |   31 -------------------------------
 2 files changed, 44 deletions(-)

Index: tip/arch/powerpc/include/asm/thread_info.h
===================================================================
--- tip.orig/arch/powerpc/include/asm/thread_info.h
+++ tip/arch/powerpc/include/asm/thread_info.h
@@ -62,21 +62,8 @@ struct thread_info {
 #define init_thread_info	(init_thread_union.thread_info)
 #define init_stack		(init_thread_union.stack)
 
-/* thread information allocation */
-
-#if THREAD_SHIFT >= PAGE_SHIFT
-
 #define THREAD_SIZE_ORDER	(THREAD_SHIFT - PAGE_SHIFT)
 
-#else /* THREAD_SHIFT < PAGE_SHIFT */
-
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
-extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node);
-extern void free_thread_info(struct thread_info *ti);
-
-#endif /* THREAD_SHIFT < PAGE_SHIFT */
-
 /* how to get the thread information struct from C */
 static inline struct thread_info *current_thread_info(void)
 {
Index: tip/arch/powerpc/kernel/process.c
===================================================================
--- tip.orig/arch/powerpc/kernel/process.c
+++ tip/arch/powerpc/kernel/process.c
@@ -1252,37 +1252,6 @@ void __ppc64_runlatch_off(void)
 }
 #endif /* CONFIG_PPC64 */
 
-#if THREAD_SHIFT < PAGE_SHIFT
-
-static struct kmem_cache *thread_info_cache;
-
-struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node)
-{
-	struct thread_info *ti;
-
-	ti = kmem_cache_alloc_node(thread_info_cache, GFP_KERNEL, node);
-	if (unlikely(ti == NULL))
-		return NULL;
-#ifdef CONFIG_DEBUG_STACK_USAGE
-	memset(ti, 0, THREAD_SIZE);
-#endif
-	return ti;
-}
-
-void free_thread_info(struct thread_info *ti)
-{
-	kmem_cache_free(thread_info_cache, ti);
-}
-
-void thread_info_cache_init(void)
-{
-	thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE,
-					      THREAD_SIZE, 0, NULL);
-	BUG_ON(thread_info_cache == NULL);
-}
-
-#endif /* THREAD_SHIFT < PAGE_SHIFT */
-
 unsigned long arch_align_stack(unsigned long sp)
 {
 	if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)



^ permalink raw reply	[flat|nested] 57+ messages in thread

* [patch 12/18] mn10300: Use common threadinfo allocator
  2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
                   ` (10 preceding siblings ...)
  2012-05-05 15:05 ` [patch 11/18] mips: " Thomas Gleixner
@ 2012-05-05 15:05 ` Thomas Gleixner
  2012-05-08 12:42   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  2012-05-05 15:05 ` [patch 13/18] powerpc: " Thomas Gleixner
                   ` (5 subsequent siblings)
  17 siblings, 1 reply; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML; +Cc: David Howells

[-- Attachment #1: mn10300-use-common-threadinfo-allocator.patch --]
[-- Type: text/plain, Size: 2177 bytes --]

Let the core code allocate and handle the kgdb cleanup with the
arch_release_thread_info() function.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: David Howells <dhowells@redhat.com>
---
 arch/mn10300/include/asm/thread_info.h |   17 +++--------------
 arch/mn10300/kernel/kgdb.c             |    3 +--
 2 files changed, 4 insertions(+), 16 deletions(-)

Index: tip/arch/mn10300/include/asm/thread_info.h
===================================================================
--- tip.orig/arch/mn10300/include/asm/thread_info.h
+++ tip/arch/mn10300/include/asm/thread_info.h
@@ -20,8 +20,10 @@
 
 #ifdef CONFIG_4KSTACKS
 #define THREAD_SIZE		(4096)
+#define THREAD_SIZE_ORDER	(0)
 #else
 #define THREAD_SIZE		(8192)
+#define THREAD_SIZE_ORDER	(1)
 #endif
 
 #define STACK_WARN		(THREAD_SIZE / 8)
@@ -120,21 +122,8 @@ static inline unsigned long current_stac
 	return sp;
 }
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
-/* thread information allocation */
-#ifdef CONFIG_DEBUG_STACK_USAGE
-#define alloc_thread_info_node(tsk, node)			\
-		kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
-#else
-#define alloc_thread_info_node(tsk, node)			\
-		kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
-#endif
-
 #ifndef CONFIG_KGDB
-#define free_thread_info(ti)	kfree((ti))
-#else
-extern void free_thread_info(struct thread_info *);
+void arch_release_thread_info(struct thread_info *ti)
 #endif
 #define get_thread_info(ti)	get_task_struct((ti)->task)
 #define put_thread_info(ti)	put_task_struct((ti)->task)
Index: tip/arch/mn10300/kernel/kgdb.c
===================================================================
--- tip.orig/arch/mn10300/kernel/kgdb.c
+++ tip/arch/mn10300/kernel/kgdb.c
@@ -397,7 +397,7 @@ static bool kgdb_arch_undo_singlestep(st
  * single-step state is cleared.  At this point the breakpoints should have
  * been removed by __switch_to().
  */
-void free_thread_info(struct thread_info *ti)
+void arch_release_thread_info(struct thread_info *ti)
 {
 	if (kgdb_sstep_thread == ti) {
 		kgdb_sstep_thread = NULL;
@@ -407,7 +407,6 @@ void free_thread_info(struct thread_info
 		 * so force immediate reentry */
 		kgdb_breakpoint();
 	}
-	kfree(ti);
 }
 
 /*



^ permalink raw reply	[flat|nested] 57+ messages in thread

* [patch 15/18] sh: Use common threadinfo allocator
  2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
                   ` (13 preceding siblings ...)
  2012-05-05 15:05 ` [patch 14/18] score: " Thomas Gleixner
@ 2012-05-05 15:05 ` Thomas Gleixner
  2012-05-08 12:43   ` [tip:smp/hotplug] sh-use-common-threadinfo-allocator tip-bot for Thomas Gleixner
  2012-05-05 15:05 ` [patch 16/18] sparc: Use common threadinfo allocator Thomas Gleixner
                   ` (2 subsequent siblings)
  17 siblings, 1 reply; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML; +Cc: Paul Mundt

[-- Attachment #1: sh-use-common-threadinfo-allocator.patch --]
[-- Type: text/plain, Size: 2853 bytes --]

The core now has a threadinfo allocator which uses a kmemcache when
THREAD_SIZE < PAGE_SIZE.

Deal with the xstate cleanup in the new arch_release_task_struct()
function.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Paul Mundt <lethal@linux-sh.org>
---
 arch/sh/include/asm/thread_info.h |   10 --------
 arch/sh/kernel/process.c          |   46 +-------------------------------------
 2 files changed, 3 insertions(+), 53 deletions(-)

Index: tip/arch/sh/include/asm/thread_info.h
===================================================================
--- tip.orig/arch/sh/include/asm/thread_info.h
+++ tip/arch/sh/include/asm/thread_info.h
@@ -88,21 +88,13 @@ static inline struct thread_info *curren
 	return ti;
 }
 
-/* thread information allocation */
-#if THREAD_SHIFT >= PAGE_SHIFT
-
 #define THREAD_SIZE_ORDER	(THREAD_SHIFT - PAGE_SHIFT)
 
-#endif
-
-extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node);
-extern void free_thread_info(struct thread_info *ti);
 extern void arch_task_cache_init(void);
 extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
+extern void arch_release_task_struct(struct task_struct *tsk);
 extern void init_thread_xstate(void);
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
 #endif /* __ASSEMBLY__ */
 
 /*
Index: tip/arch/sh/kernel/process.c
===================================================================
--- tip.orig/arch/sh/kernel/process.c
+++ tip/arch/sh/kernel/process.c
@@ -29,52 +29,10 @@ void free_thread_xstate(struct task_stru
 	}
 }
 
-#if THREAD_SHIFT < PAGE_SHIFT
-static struct kmem_cache *thread_info_cache;
-
-struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node)
-{
-	struct thread_info *ti;
-#ifdef CONFIG_DEBUG_STACK_USAGE
-	gfp_t mask = GFP_KERNEL | __GFP_ZERO;
-#else
-	gfp_t mask = GFP_KERNEL;
-#endif
-
-	ti = kmem_cache_alloc_node(thread_info_cache, mask, node);
-	return ti;
-}
-
-void free_thread_info(struct thread_info *ti)
-{
-	free_thread_xstate(ti->task);
-	kmem_cache_free(thread_info_cache, ti);
-}
-
-void thread_info_cache_init(void)
-{
-	thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE,
-					      THREAD_SIZE, SLAB_PANIC, NULL);
-}
-#else
-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);
-
-	return page ? page_address(page) : NULL;
-}
-
-void free_thread_info(struct thread_info *ti)
+void arch_release_task_struct(struct task_struct *tsk)
 {
-	free_thread_xstate(ti->task);
-	free_pages((unsigned long)ti, THREAD_SIZE_ORDER);
+	free_thread_xstate(tsk);
 }
-#endif /* THREAD_SHIFT < PAGE_SHIFT */
 
 void arch_task_cache_init(void)
 {



^ permalink raw reply	[flat|nested] 57+ messages in thread

* [patch 14/18] score: Use common threadinfo allocator
  2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
                   ` (12 preceding siblings ...)
  2012-05-05 15:05 ` [patch 13/18] powerpc: " Thomas Gleixner
@ 2012-05-05 15:05 ` Thomas Gleixner
  2012-05-08 12:44   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  2012-05-05 15:05 ` [patch 15/18] sh: " Thomas Gleixner
                   ` (3 subsequent siblings)
  17 siblings, 1 reply; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML; +Cc: Lennox Wu

[-- Attachment #1: score-use-common-threadinfo-allocator.patch --]
[-- Type: text/plain, Size: 1248 bytes --]

No point in using kmalloc for allocating 2 pages.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Lennox Wu <lennox.wu@gmail.com> 
---
 arch/score/include/asm/thread_info.h |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Index: tip/arch/score/include/asm/thread_info.h
===================================================================
--- tip.orig/arch/score/include/asm/thread_info.h
+++ tip/arch/score/include/asm/thread_info.h
@@ -11,10 +11,9 @@
 #include <linux/const.h>
 
 /* thread information allocation */
-#define THREAD_SIZE_ORDER 	(1)
-#define THREAD_SIZE 		(PAGE_SIZE << THREAD_SIZE_ORDER)
-#define THREAD_MASK 		(THREAD_SIZE - _AC(1,UL))
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
+#define THREAD_SIZE_ORDER	(1)
+#define THREAD_SIZE		(PAGE_SIZE << THREAD_SIZE_ORDER)
+#define THREAD_MASK		(THREAD_SIZE - _AC(1,UL))
 
 #ifndef __ASSEMBLY__
 
@@ -71,9 +70,6 @@ struct thread_info {
 register struct thread_info *__current_thread_info __asm__("r28");
 #define current_thread_info()	__current_thread_info
 
-#define alloc_thread_info_node(tsk, node) kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
-#define free_thread_info(info) kfree(info)
-
 #endif /* !__ASSEMBLY__ */
 
 #define PREEMPT_ACTIVE		0x10000000



^ permalink raw reply	[flat|nested] 57+ messages in thread

* [patch 16/18] sparc: Use common threadinfo allocator
  2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
                   ` (14 preceding siblings ...)
  2012-05-05 15:05 ` [patch 15/18] sh: " Thomas Gleixner
@ 2012-05-05 15:05 ` Thomas Gleixner
  2012-05-06 17:03   ` David Miller
  2012-05-08 12:45   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  2012-05-05 15:05 ` [patch 17/18] tile: " Thomas Gleixner
  2012-05-05 15:05 ` [patch 18/18] task_allocator: Use config switches instead of magic defines Thomas Gleixner
  17 siblings, 2 replies; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML; +Cc: David S. Miller

[-- Attachment #1: sparc-use-common-threadinfo-allocator.patch --]
[-- Type: text/plain, Size: 1486 bytes --]

Exaclty the same as the core code.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: "David S. Miller" <davem@davemloft.net>
---
 arch/sparc/include/asm/thread_info_64.h |   25 ++-----------------------
 1 file changed, 2 insertions(+), 23 deletions(-)

Index: tip/arch/sparc/include/asm/thread_info_64.h
===================================================================
--- tip.orig/arch/sparc/include/asm/thread_info_64.h
+++ tip/arch/sparc/include/asm/thread_info_64.h
@@ -138,32 +138,11 @@ register struct thread_info *current_thr
 
 /* thread information allocation */
 #if PAGE_SHIFT == 13
-#define __THREAD_INFO_ORDER	1
+#define THREAD_SIZE_ORDER	1
 #else /* PAGE_SHIFT == 13 */
-#define __THREAD_INFO_ORDER	0
+#define THREAD_SIZE_ORDER	0
 #endif /* PAGE_SHIFT == 13 */
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
-#ifdef CONFIG_DEBUG_STACK_USAGE
-#define THREAD_FLAGS (GFP_KERNEL | __GFP_ZERO)
-#else
-#define THREAD_FLAGS (GFP_KERNEL)
-#endif
-
-#define alloc_thread_info_node(tsk, node)				\
-({									\
-	struct page *page = alloc_pages_node(node, THREAD_FLAGS,	\
-					     __THREAD_INFO_ORDER);	\
-	struct thread_info *ret;					\
-									\
-	ret = page ? page_address(page) : NULL;				\
-	ret;								\
-})
-
-#define free_thread_info(ti) \
-	free_pages((unsigned long)(ti),__THREAD_INFO_ORDER)
-
 #define __thread_flag_byte_ptr(ti)	\
 	((unsigned char *)(&((ti)->flags)))
 #define __cur_thread_flag_byte_ptr	__thread_flag_byte_ptr(current_thread_info())



^ permalink raw reply	[flat|nested] 57+ messages in thread

* [patch 17/18] tile: Use common threadinfo allocator
  2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
                   ` (15 preceding siblings ...)
  2012-05-05 15:05 ` [patch 16/18] sparc: Use common threadinfo allocator Thomas Gleixner
@ 2012-05-05 15:05 ` Thomas Gleixner
  2012-05-05 15:21   ` Chris Metcalf
  2012-05-08 12:34   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  2012-05-05 15:05 ` [patch 18/18] task_allocator: Use config switches instead of magic defines Thomas Gleixner
  17 siblings, 2 replies; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML; +Cc: Chris Metcalf

[-- Attachment #1: tile-use-common-threadinfo-allocator.patch --]
[-- Type: text/plain, Size: 2245 bytes --]

Use the core allocator and deal with the extra cleanup in
arch_release_thread_info().

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Chris Metcalf <cmetcalf@tilera.com>
---
 arch/tile/include/asm/thread_info.h |    6 ++----
 arch/tile/kernel/process.c          |   23 ++---------------------
 2 files changed, 4 insertions(+), 25 deletions(-)

Index: tip/arch/tile/include/asm/thread_info.h
===================================================================
--- tip.orig/arch/tile/include/asm/thread_info.h
+++ tip/arch/tile/include/asm/thread_info.h
@@ -77,16 +77,14 @@ struct thread_info {
 
 #ifndef __ASSEMBLY__
 
+void arch_release_thread_info(struct thread_info *info);
+
 /* How to get the thread information struct from C. */
 register unsigned long stack_pointer __asm__("sp");
 
 #define current_thread_info() \
   ((struct thread_info *)(stack_pointer & -THREAD_SIZE))
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-extern struct thread_info *alloc_thread_info_node(struct task_struct *task, int node);
-extern void free_thread_info(struct thread_info *info);
-
 /* Sit on a nap instruction until interrupted. */
 extern void smp_nap(void);
 
Index: tip/arch/tile/kernel/process.c
===================================================================
--- tip.orig/arch/tile/kernel/process.c
+++ tip/arch/tile/kernel/process.c
@@ -114,27 +114,10 @@ void cpu_idle(void)
 	}
 }
 
-struct thread_info *alloc_thread_info_node(struct task_struct *task, int node)
-{
-	struct page *page;
-	gfp_t flags = GFP_KERNEL;
-
-#ifdef CONFIG_DEBUG_STACK_USAGE
-	flags |= __GFP_ZERO;
-#endif
-
-	page = alloc_pages_node(node, flags, THREAD_SIZE_ORDER);
-	if (!page)
-		return NULL;
-
-	return (struct thread_info *)page_address(page);
-}
-
 /*
- * Free a thread_info node, and all of its derivative
- * data structures.
+ * Release a thread_info structure
  */
-void free_thread_info(struct thread_info *info)
+void arch_release_thread_info(struct thread_info *info)
 {
 	struct single_step_state *step_state = info->step_state;
 
@@ -169,8 +152,6 @@ void free_thread_info(struct thread_info
 		 */
 		kfree(step_state);
 	}
-
-	free_pages((unsigned long)info, THREAD_SIZE_ORDER);
 }
 
 static void save_arch_state(struct thread_struct *t);



^ permalink raw reply	[flat|nested] 57+ messages in thread

* [patch 18/18] task_allocator: Use config switches instead of magic defines
  2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
                   ` (16 preceding siblings ...)
  2012-05-05 15:05 ` [patch 17/18] tile: " Thomas Gleixner
@ 2012-05-05 15:05 ` Thomas Gleixner
  2012-05-07 20:32   ` Sam Ravnborg
  2012-05-08 12:46   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  17 siblings, 2 replies; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-05 15:05 UTC (permalink / raw)
  To: LKML; +Cc: Sam Ravnborg, Tony Luck

[-- Attachment #1: task_allocator-use-config-switches-instead-of-magic-defines.patch --]
[-- Type: text/plain, Size: 4048 bytes --]

Replace __HAVE_ARCH_TASK_ALLOCATOR and __HAVE_ARCH_THREAD_ALLOCATOR
with proper config switches.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Tony Luck <tony.luck@intel.com>
---
 arch/Kconfig                            |    8 ++++++++
 arch/ia64/Kconfig                       |    2 ++
 arch/ia64/include/asm/thread_info.h     |    3 ---
 arch/sparc/Kconfig                      |    1 +
 arch/sparc/include/asm/thread_info_32.h |    2 --
 kernel/fork.c                           |    7 +++----
 6 files changed, 14 insertions(+), 9 deletions(-)

Index: tip/arch/Kconfig
===================================================================
--- tip.orig/arch/Kconfig
+++ tip/arch/Kconfig
@@ -152,6 +152,14 @@ config GENERIC_SMP_IDLE_THREAD
 config ARCH_INIT_TASK
        bool
 
+# Select if arch has its private alloc_task_struct() function
+config ARCH_TASK_STRUCT_ALLOCATOR
+	bool
+
+# Select if arch has its private alloc_thread_info() function
+config ARCH_THREAD_INFO_ALLOCATOR
+	bool
+
 config HAVE_REGS_AND_STACK_ACCESS_API
 	bool
 	help
Index: tip/arch/ia64/Kconfig
===================================================================
--- tip.orig/arch/ia64/Kconfig
+++ tip/arch/ia64/Kconfig
@@ -35,6 +35,8 @@ config IA64
 	select GENERIC_IOMAP
 	select GENERIC_SMP_IDLE_THREAD
 	select ARCH_INIT_TASK
+	select ARCH_TASK_STRUCT_ALLOCATOR
+	select ARCH_THREAD_INFO_ALLOCATOR
 	default y
 	help
 	  The Itanium Processor Family is Intel's 64-bit successor to
Index: tip/arch/ia64/include/asm/thread_info.h
===================================================================
--- tip.orig/arch/ia64/include/asm/thread_info.h
+++ tip/arch/ia64/include/asm/thread_info.h
@@ -54,8 +54,6 @@ struct thread_info {
 	},					\
 }
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
 #ifndef ASM_OFFSETS_C
 /* how to get the thread information struct from C */
 #define current_thread_info()	((struct thread_info *) ((char *) current + IA64_TASK_SIZE))
@@ -84,7 +82,6 @@ struct thread_info {
 #endif
 #define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET)
 
-#define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
 #define alloc_task_struct_node(node)						\
 ({										\
 	struct page *page = alloc_pages_node(node, GFP_KERNEL | __GFP_COMP,	\
Index: tip/arch/sparc/Kconfig
===================================================================
--- tip.orig/arch/sparc/Kconfig
+++ tip/arch/sparc/Kconfig
@@ -36,6 +36,7 @@ config SPARC32
 	def_bool !64BIT
 	select GENERIC_ATOMIC64
 	select CLZ_TAB
+	select ARCH_THREAD_INFO_ALLOCATOR
 
 config SPARC64
 	def_bool 64BIT
Index: tip/arch/sparc/include/asm/thread_info_32.h
===================================================================
--- tip.orig/arch/sparc/include/asm/thread_info_32.h
+++ tip/arch/sparc/include/asm/thread_info_32.h
@@ -80,8 +80,6 @@ register struct thread_info *current_thr
  */
 #define THREAD_INFO_ORDER  1
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
 BTFIXUPDEF_CALL(struct thread_info *, alloc_thread_info_node, int)
 #define alloc_thread_info_node(tsk, node) BTFIXUP_CALL(alloc_thread_info_node)(node)
 
Index: tip/kernel/fork.c
===================================================================
--- tip.orig/kernel/fork.c
+++ tip/kernel/fork.c
@@ -111,7 +111,7 @@ int nr_processes(void)
 	return total;
 }
 
-#ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
+#ifndef CONFIG_ARCH_TASK_STRUCT_ALLOCATOR
 static struct kmem_cache *task_struct_cachep;
 
 static inline struct task_struct *alloc_task_struct_node(int node)
@@ -128,8 +128,7 @@ static inline void free_task_struct(stru
 }
 #endif
 
-#ifndef __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
+#ifndef CONFIG_ARCH_THREAD_INFO_ALLOCATOR
 void __weak arch_release_thread_info(struct thread_info *ti) { }
 
 /*
@@ -243,7 +242,7 @@ void __init __weak arch_task_cache_init(
 
 void __init fork_init(unsigned long mempages)
 {
-#ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
+#ifndef CONFIG_ARCH_TASK_STRUCT_ALLOCATOR
 #ifndef ARCH_MIN_TASKALIGN
 #define ARCH_MIN_TASKALIGN	L1_CACHE_BYTES
 #endif



^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [patch 17/18] tile: Use common threadinfo allocator
  2012-05-05 15:05 ` [patch 17/18] tile: " Thomas Gleixner
@ 2012-05-05 15:21   ` Chris Metcalf
  2012-05-07 19:45     ` Thomas Gleixner
  2012-05-08 12:34   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  1 sibling, 1 reply; 57+ messages in thread
From: Chris Metcalf @ 2012-05-05 15:21 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML

On 5/5/2012 11:05 AM, Thomas Gleixner wrote:
> Use the core allocator and deal with the extra cleanup in
> arch_release_thread_info().
>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Chris Metcalf <cmetcalf@tilera.com>
> ---
>  arch/tile/include/asm/thread_info.h |    6 ++----
>  arch/tile/kernel/process.c          |   23 ++---------------------
>  2 files changed, 4 insertions(+), 25 deletions(-)

We have some changes we haven't yet merged upstream that this will likely
conflict with.

You may note that we have APIs like homecache_alloc_pages() that take a
core or other magic value to indicate what the "home" cache should be on
our architecture.  This enables significant performance optimizations when
you can co-locate the home cache with where most of the core references are
coming from.

The additional changes we haven't yet merged are in the area of managing
the home cache dynamically.  Rather than just setting the home cache at
allocation time, we allow it to be modified dynamically: for example, as
the process migrates, we migrate the kernel and user stack pages.  This is
tricky since there are lots of coherence issues to manage, and the changes
we have include a variety of changes in the core mm code to handle
transitioning the home cache, proper locking, unmapping, hooks in the buddy
allocator, blocking other cores while a page is transitioning, etc etc.

But, the relevance to this change is that as part of that code, we use the
homecache_alloc_page() method to set the home cache of a kernel stack page
to be the core that is running the thread (and then migrate the home cache
dynamically after that).  Using the new proposed core allocator will mean
we lose that hook.  We don't need a free hook (when we're using the dynamic
mode we are already hooked into the allocator itself), but we do need a way
to know when we're allocating a kernel stack page as opposed to any other
kind of a page.

The simplest approach is of course just to allow
__HAVE_ARCH_THREAD_INFO_ALLOCATOR to continue to be meaningful and use it
for tile, but maybe there's some halfway point.  For example, that symbol
could refer only to the allocate function, and not also imply an
arch-specific free function.  Or, we could have a new much more focused
override that was just "a function to use instead of alloc_pages_node",
e.g. provide a weak alloc_threadinfo_pages_node() that just was generically
just a call to alloc_pages_node, which architectures could override.

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com


^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [patch 01/18] fork: Remove the weak insanity
  2012-05-05 15:05 ` [patch 01/18] fork: Remove the weak insanity Thomas Gleixner
@ 2012-05-05 15:58   ` Sam Ravnborg
  2012-05-07 20:55     ` Thomas Gleixner
  2012-05-08 12:31   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  1 sibling, 1 reply; 57+ messages in thread
From: Sam Ravnborg @ 2012-05-05 15:58 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML

On Sat, May 05, 2012 at 03:05:40PM -0000, Thomas Gleixner wrote:
> We error out when compiling with gcc4.1.[01] as it miscompiles
> __weak. The workaround with magic defines is not longer
> necessary. Make it __weak again.

The cleanup is much appreciated!

But the magic defines is IMO much better than the CONFIG_ based approach
that this patch-set introduces in the last patch.

If you do:

    $git grep arch_task_cache_init

Then if you see:

    #define arch_task_cache_init arch_task_cache_init

Then you know alrady that this arch will provide a local implementation
of arch_task_cache_init().
No need to grep for an ARCH_XXX symbol that you need to look up
somewhere else.

	Sam

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [patch 16/18] sparc: Use common threadinfo allocator
  2012-05-05 15:05 ` [patch 16/18] sparc: Use common threadinfo allocator Thomas Gleixner
@ 2012-05-06 17:03   ` David Miller
  2012-05-08 12:45   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 57+ messages in thread
From: David Miller @ 2012-05-06 17:03 UTC (permalink / raw)
  To: tglx; +Cc: linux-kernel

From: Thomas Gleixner <tglx@linutronix.de>
Date: Sat, 05 May 2012 15:05:47 -0000

> Exaclty the same as the core code.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [patch 03/18] fork: Move thread info gfp flags to header
  2012-05-05 15:05 ` [patch 03/18] fork: Move thread info gfp flags to header Thomas Gleixner
@ 2012-05-07  4:34   ` Paul E. McKenney
  2012-05-07 13:38     ` Paul E. McKenney
  2012-05-07 19:14     ` Thomas Gleixner
  2012-05-08 12:32   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  1 sibling, 2 replies; 57+ messages in thread
From: Paul E. McKenney @ 2012-05-07  4:34 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML

On Sat, May 05, 2012 at 03:05:41PM -0000, Thomas Gleixner wrote:
> These flags can be useful for extra allocations outside of the core
> code.
> 
> Add __GFP_NOTRACE to them, so the archs which have kmemcheck do
> not have to provide extra allocators just for that reason.

This breaks powerpc builds due to __GFP_NOTRACE not being defined.
I restarted the test after removing the __GFP_NOTRACE as a testing-only
hack, and will let you know how it goes.  Also looking into why this
builds on 32-bit x86 but not on powerpc.

							Thanx, Paul

> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
>  include/linux/thread_info.h |    6 ++++++
>  kernel/fork.c               |    8 ++------
>  2 files changed, 8 insertions(+), 6 deletions(-)
> 
> Index: tip/include/linux/thread_info.h
> ===================================================================
> --- tip.orig/include/linux/thread_info.h
> +++ tip/include/linux/thread_info.h
> @@ -54,6 +54,12 @@ extern long do_no_restart_syscall(struct
> 
>  #ifdef __KERNEL__
> 
> +#ifdef CONFIG_DEBUG_STACK_USAGE
> +# define THREADINFO_GFP		(GFP_KERNEL | __GFP_NOTRACE | __GFP_ZERO)
> +#else
> +# define THREADINFO_GFP		(GFP_KERNEL | __GFP_NOTRACE)
> +#endif
> +
>  /*
>   * flag set/clear/test wrappers
>   * - pass TIF_xxxx constants to these functions
> Index: tip/kernel/fork.c
> ===================================================================
> --- tip.orig/kernel/fork.c
> +++ tip/kernel/fork.c
> @@ -135,12 +135,8 @@ void __weak arch_release_thread_info(str
>  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;
>  }
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [patch 03/18] fork: Move thread info gfp flags to header
  2012-05-07  4:34   ` Paul E. McKenney
@ 2012-05-07 13:38     ` Paul E. McKenney
  2012-05-07 19:14     ` Thomas Gleixner
  1 sibling, 0 replies; 57+ messages in thread
From: Paul E. McKenney @ 2012-05-07 13:38 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML

On Sun, May 06, 2012 at 09:34:01PM -0700, Paul E. McKenney wrote:
> On Sat, May 05, 2012 at 03:05:41PM -0000, Thomas Gleixner wrote:
> > These flags can be useful for extra allocations outside of the core
> > code.
> > 
> > Add __GFP_NOTRACE to them, so the archs which have kmemcheck do
> > not have to provide extra allocators just for that reason.
> 
> This breaks powerpc builds due to __GFP_NOTRACE not being defined.
> I restarted the test after removing the __GFP_NOTRACE as a testing-only
> hack, and will let you know how it goes.  Also looking into why this
> builds on 32-bit x86 but not on powerpc.

And the reason that it built on 32-bit x86 was that I mistakenly
built only the RCU files, not the whole kernel.  So I am guessing
that there is something I need to merge into tip/smp/hotplug.

On the other hand, removing the __GFP_NOTRACE allows this patchset to
pass modest rcutorture testing on Power.  ;-)

							Thanx, Paul


^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [patch 03/18] fork: Move thread info gfp flags to header
  2012-05-07  4:34   ` Paul E. McKenney
  2012-05-07 13:38     ` Paul E. McKenney
@ 2012-05-07 19:14     ` Thomas Gleixner
  2012-05-07 20:53       ` Paul E. McKenney
  1 sibling, 1 reply; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-07 19:14 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: LKML

On Sun, 6 May 2012, Paul E. McKenney wrote:

> On Sat, May 05, 2012 at 03:05:41PM -0000, Thomas Gleixner wrote:
> > These flags can be useful for extra allocations outside of the core
> > code.
> > 
> > Add __GFP_NOTRACE to them, so the archs which have kmemcheck do
> > not have to provide extra allocators just for that reason.
> 
> This breaks powerpc builds due to __GFP_NOTRACE not being defined.
> I restarted the test after removing the __GFP_NOTRACE as a testing-only
> hack, and will let you know how it goes.  Also looking into why this
> builds on 32-bit x86 but not on powerpc.

Hrmpf. Seems the idiot I am fatfingered __GFP_NOTRACK to __GFP_NOTRACE
and then only tested with the DEBUG stuff disabled......


^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [patch 17/18] tile: Use common threadinfo allocator
  2012-05-05 15:21   ` Chris Metcalf
@ 2012-05-07 19:45     ` Thomas Gleixner
  2012-05-07 20:03       ` Chris Metcalf
  0 siblings, 1 reply; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-07 19:45 UTC (permalink / raw)
  To: Chris Metcalf; +Cc: LKML

On Sat, 5 May 2012, Chris Metcalf wrote:

> On 5/5/2012 11:05 AM, Thomas Gleixner wrote:
> > Use the core allocator and deal with the extra cleanup in
> > arch_release_thread_info().
> >
> > Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Chris Metcalf <cmetcalf@tilera.com>
> > ---
> >  arch/tile/include/asm/thread_info.h |    6 ++----
> >  arch/tile/kernel/process.c          |   23 ++---------------------
> >  2 files changed, 4 insertions(+), 25 deletions(-)
> 
> We have some changes we haven't yet merged upstream that this will likely
> conflict with.
> 
> You may note that we have APIs like homecache_alloc_pages() that take a
> core or other magic value to indicate what the "home" cache should be on
> our architecture.  This enables significant performance optimizations when
> you can co-locate the home cache with where most of the core references are
> coming from.
> 
> The additional changes we haven't yet merged are in the area of managing
> the home cache dynamically.  Rather than just setting the home cache at
> allocation time, we allow it to be modified dynamically: for example, as
> the process migrates, we migrate the kernel and user stack pages.  This is
> tricky since there are lots of coherence issues to manage, and the changes
> we have include a variety of changes in the core mm code to handle
> transitioning the home cache, proper locking, unmapping, hooks in the buddy
> allocator, blocking other cores while a page is transitioning, etc etc.
> 
> But, the relevance to this change is that as part of that code, we use the
> homecache_alloc_page() method to set the home cache of a kernel stack page
> to be the core that is running the thread (and then migrate the home cache
> dynamically after that).  Using the new proposed core allocator will mean
> we lose that hook.  We don't need a free hook (when we're using the dynamic
> mode we are already hooked into the allocator itself), but we do need a way
> to know when we're allocating a kernel stack page as opposed to any other
> kind of a page.

What's the difference between a kernel stack page for a given node and
a page which is allocated on a given node ?
 
> The simplest approach is of course just to allow
> __HAVE_ARCH_THREAD_INFO_ALLOCATOR to continue to be meaningful and use it
> for tile, but maybe there's some halfway point.  For example, that symbol
> could refer only to the allocate function, and not also imply an
> arch-specific free function.  Or, we could have a new much more focused
> override that was just "a function to use instead of alloc_pages_node",
> e.g. provide a weak alloc_threadinfo_pages_node() that just was generically
> just a call to alloc_pages_node, which architectures could override.

Again, that would give you what? 

If you treat kernel stack pages different to general pages allocated
on a node then why not using a special GFP flag for that purpose?

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [patch 06/18] c6x: Use common threadinfo allocator
  2012-05-05 15:05 ` [patch 06/18] c6x: " Thomas Gleixner
@ 2012-05-07 19:49   ` Mark Salter
  2012-05-08 12:36   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 57+ messages in thread
From: Mark Salter @ 2012-05-07 19:49 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML

On Sat, 2012-05-05 at 15:05 +0000, Thomas Gleixner wrote:
> There is no functional difference. __get_free_pages() ends up calling
> alloc_pages_node().
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Acked-by: Mark Salter <msalter@redhat.com>



^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [patch 17/18] tile: Use common threadinfo allocator
  2012-05-07 19:45     ` Thomas Gleixner
@ 2012-05-07 20:03       ` Chris Metcalf
  2012-05-07 20:33         ` Thomas Gleixner
  0 siblings, 1 reply; 57+ messages in thread
From: Chris Metcalf @ 2012-05-07 20:03 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML

On 5/7/2012 3:45 PM, Thomas Gleixner wrote:
> On Sat, 5 May 2012, Chris Metcalf wrote:
>
>> On 5/5/2012 11:05 AM, Thomas Gleixner wrote:
>>> Use the core allocator and deal with the extra cleanup in
>>> arch_release_thread_info().
>>>
>>> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
>>> Cc: Chris Metcalf <cmetcalf@tilera.com>
>>> ---
>>>  arch/tile/include/asm/thread_info.h |    6 ++----
>>>  arch/tile/kernel/process.c          |   23 ++---------------------
>>>  2 files changed, 4 insertions(+), 25 deletions(-)
>> We have some changes we haven't yet merged upstream that this will likely
>> conflict with.
>>
>> You may note that we have APIs like homecache_alloc_pages() that take a
>> core or other magic value to indicate what the "home" cache should be on
>> our architecture.  This enables significant performance optimizations when
>> you can co-locate the home cache with where most of the core references are
>> coming from.
>>
>> The additional changes we haven't yet merged are in the area of managing
>> the home cache dynamically.  Rather than just setting the home cache at
>> allocation time, we allow it to be modified dynamically: for example, as
>> the process migrates, we migrate the kernel and user stack pages.  This is
>> tricky since there are lots of coherence issues to manage, and the changes
>> we have include a variety of changes in the core mm code to handle
>> transitioning the home cache, proper locking, unmapping, hooks in the buddy
>> allocator, blocking other cores while a page is transitioning, etc etc.
>>
>> But, the relevance to this change is that as part of that code, we use the
>> homecache_alloc_page() method to set the home cache of a kernel stack page
>> to be the core that is running the thread (and then migrate the home cache
>> dynamically after that).  Using the new proposed core allocator will mean
>> we lose that hook.  We don't need a free hook (when we're using the dynamic
>> mode we are already hooked into the allocator itself), but we do need a way
>> to know when we're allocating a kernel stack page as opposed to any other
>> kind of a page.
> What's the difference between a kernel stack page for a given node and
> a page which is allocated on a given node ?

No difference except in how it is allocated (and of course how it is
used).  The task migration code currently knows that the kernel stack
should have its home cache migrated; it finds it by VA.  In the absence of
migration the kernel stack page is not treated differently than any other
page_alloc'ed page.

>> The simplest approach is of course just to allow
>> __HAVE_ARCH_THREAD_INFO_ALLOCATOR to continue to be meaningful and use it
>> for tile, but maybe there's some halfway point.  For example, that symbol
>> could refer only to the allocate function, and not also imply an
>> arch-specific free function.  Or, we could have a new much more focused
>> override that was just "a function to use instead of alloc_pages_node",
>> e.g. provide a weak alloc_threadinfo_pages_node() that just was generically
>> just a call to alloc_pages_node, which architectures could override.
> Again, that would give you what? 

The advantage is that when you initially allocate the stack page, you can
set its home cache appropriately to be on the local cpu, where the new task
is likely to run.  Otherwise, you could imagine using a suitable hook for
when the task starts up to migrate the page at that point, but you miss out
on the opportunity to have the allocator return a suitably-cached page up
front when the task is created.

> If you treat kernel stack pages different to general pages allocated
> on a node then why not using a special GFP flag for that purpose?

There are certainly different possible ways to tell the allocator to
allocate a page with its cache "here" vs with its cache fully-distributed
(and thus less local, and less good for stack or percpu pages).  We use a
different approach (some per-task data structures that pass homing info to
the allocator) but we could probably use GFP_ values instead.  But the
point is we need to be able to know to do so, and I think the only obvious
way is to override something in the threadinfo allocator.

Thanks!

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com


^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [patch 18/18] task_allocator: Use config switches instead of magic defines
  2012-05-05 15:05 ` [patch 18/18] task_allocator: Use config switches instead of magic defines Thomas Gleixner
@ 2012-05-07 20:32   ` Sam Ravnborg
  2012-05-07 20:43     ` Thomas Gleixner
  2012-05-08 12:46   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
  1 sibling, 1 reply; 57+ messages in thread
From: Sam Ravnborg @ 2012-05-07 20:32 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML, Tony Luck

On Sat, May 05, 2012 at 03:05:48PM -0000, Thomas Gleixner wrote:
> Replace __HAVE_ARCH_TASK_ALLOCATOR and __HAVE_ARCH_THREAD_ALLOCATOR
> with proper config switches.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Tony Luck <tony.luck@intel.com>

> Index: tip/arch/sparc/include/asm/thread_info_32.h
> ===================================================================
> --- tip.orig/arch/sparc/include/asm/thread_info_32.h
> +++ tip/arch/sparc/include/asm/thread_info_32.h
> @@ -80,8 +80,6 @@ register struct thread_info *current_thr
>   */
>  #define THREAD_INFO_ORDER  1
>  
> -#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
> -
>  BTFIXUPDEF_CALL(struct thread_info *, alloc_thread_info_node, int)
>  #define alloc_thread_info_node(tsk, node) BTFIXUP_CALL(alloc_thread_info_node)(node)

On the sparc mailing list we have discussed to drop
support for sun4c - and decided to do so.
With sun4c dropped sparc32 will be able to use the
generic variant too.

I will take care to introduce the generic variant
when sparc32 is ready.

	Sam

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [patch 17/18] tile: Use common threadinfo allocator
  2012-05-07 20:03       ` Chris Metcalf
@ 2012-05-07 20:33         ` Thomas Gleixner
  2012-05-07 20:52           ` Chris Metcalf
  0 siblings, 1 reply; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-07 20:33 UTC (permalink / raw)
  To: Chris Metcalf; +Cc: LKML, Peter Zijlstra

On Mon, 7 May 2012, Chris Metcalf wrote:
> On 5/7/2012 3:45 PM, Thomas Gleixner wrote:
> > What's the difference between a kernel stack page for a given node and
> > a page which is allocated on a given node ?
> 
> No difference except in how it is allocated (and of course how it is
> used).  The task migration code currently knows that the kernel stack
> should have its home cache migrated; it finds it by VA.  In the absence of
> migration the kernel stack page is not treated differently than any other
> page_alloc'ed page.
> 
> >> The simplest approach is of course just to allow
> >> __HAVE_ARCH_THREAD_INFO_ALLOCATOR to continue to be meaningful and use it
> >> for tile, but maybe there's some halfway point.  For example, that symbol
> >> could refer only to the allocate function, and not also imply an
> >> arch-specific free function.  Or, we could have a new much more focused
> >> override that was just "a function to use instead of alloc_pages_node",
> >> e.g. provide a weak alloc_threadinfo_pages_node() that just was generically
> >> just a call to alloc_pages_node, which architectures could override.
> > Again, that would give you what? 
> 
> The advantage is that when you initially allocate the stack page, you can
> set its home cache appropriately to be on the local cpu, where the new task
> is likely to run.  Otherwise, you could imagine using a suitable hook for
> when the task starts up to migrate the page at that point, but you miss out
> on the opportunity to have the allocator return a suitably-cached page up
> front when the task is created.
> 
> > If you treat kernel stack pages different to general pages allocated
> > on a node then why not using a special GFP flag for that purpose?
> 
> There are certainly different possible ways to tell the allocator to
> allocate a page with its cache "here" vs with its cache fully-distributed
> (and thus less local, and less good for stack or percpu pages).  We use a
> different approach (some per-task data structures that pass homing info to
> the allocator) but we could probably use GFP_ values instead.  But the
> point is we need to be able to know to do so, and I think the only obvious
> way is to override something in the threadinfo allocator.

Wrong. The obvious way is to use the common code and add a special
flag to it.

There is nothing wrong to add

#ifndef ARCH_THREADINFO_GFP
#define ARCH_THREADINFO_GFP (0)
#endif

and or ARCH_THREADINFO_GFP to the generic THREADINFO_GFP flags

instead of insisting on a separate allocator function for something
which has no fricking reason to be arch specific (IA64 and some weird
sparc crap aside)

Thanks,

	tglx


^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [patch 18/18] task_allocator: Use config switches instead of magic defines
  2012-05-07 20:32   ` Sam Ravnborg
@ 2012-05-07 20:43     ` Thomas Gleixner
  0 siblings, 0 replies; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-07 20:43 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: LKML, Tony Luck

On Mon, 7 May 2012, Sam Ravnborg wrote:

> On Sat, May 05, 2012 at 03:05:48PM -0000, Thomas Gleixner wrote:
> > Replace __HAVE_ARCH_TASK_ALLOCATOR and __HAVE_ARCH_THREAD_ALLOCATOR
> > with proper config switches.
> > 
> > Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Sam Ravnborg <sam@ravnborg.org>
> > Cc: Tony Luck <tony.luck@intel.com>
> 
> > Index: tip/arch/sparc/include/asm/thread_info_32.h
> > ===================================================================
> > --- tip.orig/arch/sparc/include/asm/thread_info_32.h
> > +++ tip/arch/sparc/include/asm/thread_info_32.h
> > @@ -80,8 +80,6 @@ register struct thread_info *current_thr
> >   */
> >  #define THREAD_INFO_ORDER  1
> >  
> > -#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
> > -
> >  BTFIXUPDEF_CALL(struct thread_info *, alloc_thread_info_node, int)
> >  #define alloc_thread_info_node(tsk, node) BTFIXUP_CALL(alloc_thread_info_node)(node)
> 
> On the sparc mailing list we have discussed to drop
> support for sun4c - and decided to do so.
> With sun4c dropped sparc32 will be able to use the
> generic variant too.
> 
> I will take care to introduce the generic variant
> when sparc32 is ready.

Nice :)

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [patch 17/18] tile: Use common threadinfo allocator
  2012-05-07 20:33         ` Thomas Gleixner
@ 2012-05-07 20:52           ` Chris Metcalf
  2012-05-08 12:04             ` Thomas Gleixner
  0 siblings, 1 reply; 57+ messages in thread
From: Chris Metcalf @ 2012-05-07 20:52 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML, Peter Zijlstra

On 5/7/2012 4:33 PM, Thomas Gleixner wrote:
> On Mon, 7 May 2012, Chris Metcalf wrote:
>
>> I think the only obvious
>> way is to override something in the threadinfo allocator.
> Wrong. The obvious way is to use the common code and add a special
> flag to it.

Well, that's overriding something in the threadinfo allocator :-)

In all seriousness, adding an arch-specific GFP flag sounds like it should
work OK for tile.  Thanks!

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com


^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [patch 03/18] fork: Move thread info gfp flags to header
  2012-05-07 19:14     ` Thomas Gleixner
@ 2012-05-07 20:53       ` Paul E. McKenney
  2012-05-08 17:51         ` Paul E. McKenney
  0 siblings, 1 reply; 57+ messages in thread
From: Paul E. McKenney @ 2012-05-07 20:53 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML

On Mon, May 07, 2012 at 09:14:04PM +0200, Thomas Gleixner wrote:
> On Sun, 6 May 2012, Paul E. McKenney wrote:
> 
> > On Sat, May 05, 2012 at 03:05:41PM -0000, Thomas Gleixner wrote:
> > > These flags can be useful for extra allocations outside of the core
> > > code.
> > > 
> > > Add __GFP_NOTRACE to them, so the archs which have kmemcheck do
> > > not have to provide extra allocators just for that reason.
> > 
> > This breaks powerpc builds due to __GFP_NOTRACE not being defined.
> > I restarted the test after removing the __GFP_NOTRACE as a testing-only
> > hack, and will let you know how it goes.  Also looking into why this
> > builds on 32-bit x86 but not on powerpc.
> 
> Hrmpf. Seems the idiot I am fatfingered __GFP_NOTRACK to __GFP_NOTRACE
> and then only tested with the DEBUG stuff disabled......

That sounds like something I would do...  ;-)

I will rerun with __GFP_NOTRACK.

							Thanx, Paul


^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [patch 01/18] fork: Remove the weak insanity
  2012-05-05 15:58   ` Sam Ravnborg
@ 2012-05-07 20:55     ` Thomas Gleixner
  2012-05-07 21:03       ` Sam Ravnborg
  0 siblings, 1 reply; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-07 20:55 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: LKML

On Sat, 5 May 2012, Sam Ravnborg wrote:

> On Sat, May 05, 2012 at 03:05:40PM -0000, Thomas Gleixner wrote:
> > We error out when compiling with gcc4.1.[01] as it miscompiles
> > __weak. The workaround with magic defines is not longer
> > necessary. Make it __weak again.
> 
> The cleanup is much appreciated!
> 
> But the magic defines is IMO much better than the CONFIG_ based approach
> that this patch-set introduces in the last patch.
> 
> If you do:
> 
>     $git grep arch_task_cache_init
> 
> Then if you see:
> 
>     #define arch_task_cache_init arch_task_cache_init
> 
> Then you know alrady that this arch will provide a local implementation
> of arch_task_cache_init().
> No need to grep for an ARCH_XXX symbol that you need to look up
> somewhere else.

I'm not following that argument.

Removing that magic define thing does not change anything. The change
is:

-#define arch_task_cache_init arch_task_cache_init
-#define arch_task_cache_init arch_task_cache_init
-/*
- * macro override instead of weak attribute alias, to workaround
- * gcc 4.1.0 and 4.1.1 bugs with weak attribute and empty functions.
- */
-#ifndef arch_task_cache_init
-#define arch_task_cache_init()
-#endif
+void __init __weak arch_task_cache_init(void) { }

So $git grep arch_task_cache_init still tells you who is overriding
arch_task_cache_init () which is:

arch/sh/include/asm/thread_info.h:extern void arch_task_cache_init(void);
arch/sh/kernel/process.c:void arch_task_cache_init(void)
arch/x86/include/asm/thread_info.h:extern void arch_task_cache_init(void);
arch/x86/kernel/process.c:void arch_task_cache_init(void)

What's your problem ?

Now for the last patch in the series:

It merily moves 

#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR 

to a Kconfig based

   select ARCH_THREAD_INFO_ALLOCATOR

I'm not seeing any difference except that something which is actually
a config switch is moved to the place where it belongs.

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [patch 01/18] fork: Remove the weak insanity
  2012-05-07 20:55     ` Thomas Gleixner
@ 2012-05-07 21:03       ` Sam Ravnborg
  0 siblings, 0 replies; 57+ messages in thread
From: Sam Ravnborg @ 2012-05-07 21:03 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML

On Mon, May 07, 2012 at 10:55:18PM +0200, Thomas Gleixner wrote:
> On Sat, 5 May 2012, Sam Ravnborg wrote:
> 
> > On Sat, May 05, 2012 at 03:05:40PM -0000, Thomas Gleixner wrote:
> > > We error out when compiling with gcc4.1.[01] as it miscompiles
> > > __weak. The workaround with magic defines is not longer
> > > necessary. Make it __weak again.
> > 
> > The cleanup is much appreciated!
> > 
> > But the magic defines is IMO much better than the CONFIG_ based approach
> > that this patch-set introduces in the last patch.
> > 
> > If you do:
> > 
> >     $git grep arch_task_cache_init
> > 
> > Then if you see:
> > 
> >     #define arch_task_cache_init arch_task_cache_init
> > 
> > Then you know alrady that this arch will provide a local implementation
> > of arch_task_cache_init().
> > No need to grep for an ARCH_XXX symbol that you need to look up
> > somewhere else.
> 
> I'm not following that argument.
> 
> Removing that magic define thing does not change anything. The change
> is:
...
> 
> Now for the last patch in the series:
> 
> It merily moves 
> 
> #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR 
> 
> to a Kconfig based
> 
>    select ARCH_THREAD_INFO_ALLOCATOR

The point was that rather than using a Kconfig symbol for this the
architecutres that required a dedicated implementation could do the:

    #define foo foo

trick.


And the generic implmentation should then do:
#ifndef foo
void foo(int bar)
{
}
#endif

You are right that the archs implmenting foo() will stand
out in the grep anyway.
But using the define trick you do not spread it up to the Kconfig level,
for individual functions.

	Sam

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [patch 17/18] tile: Use common threadinfo allocator
  2012-05-07 20:52           ` Chris Metcalf
@ 2012-05-08 12:04             ` Thomas Gleixner
  0 siblings, 0 replies; 57+ messages in thread
From: Thomas Gleixner @ 2012-05-08 12:04 UTC (permalink / raw)
  To: Chris Metcalf; +Cc: LKML, Peter Zijlstra

On Mon, 7 May 2012, Chris Metcalf wrote:

> On 5/7/2012 4:33 PM, Thomas Gleixner wrote:
> > On Mon, 7 May 2012, Chris Metcalf wrote:
> >
> >> I think the only obvious
> >> way is to override something in the threadinfo allocator.
> > Wrong. The obvious way is to use the common code and add a special
> > flag to it.
> 
> Well, that's overriding something in the threadinfo allocator :-)
> 
> In all seriousness, adding an arch-specific GFP flag sounds like it should
> work OK for tile.  Thanks!

I pushed out the minimum set of patches into a separate branch, so you
can base your work on that and we wont run into merge order
dependencies.

  git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git smp/threadinfo

The patch below lets you define your extra gfp flag for tile.

Thanks,

	tglx

-------->

Subject: threadinfo: Add an optional ARCH gfp flag for the threadinfo allocator

Allows architectures to add their magic gfp flags.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

--- tip.orig/include/linux/thread_info.h
+++ tip/include/linux/thread_info.h
@@ -55,11 +55,17 @@ extern long do_no_restart_syscall(struct
 #ifdef __KERNEL__
 
 #ifdef CONFIG_DEBUG_STACK_USAGE
-# define THREADINFO_GFP		(GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO)
+# define __THREADINFO_GFP	(GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO)
 #else
-# define THREADINFO_GFP		(GFP_KERNEL | __GFP_NOTRACK)
+# define __THREADINFO_GFP	(GFP_KERNEL | __GFP_NOTRACK)
 #endif
 
+#ifndef ARCH_THREAD_INFO_GFP
+# define ARCH_THREAD_INFO_GFP	(0)
+#endif
+
+#define THREADINFO_GFP		(__THREADINFO_GFP | ARCH_THREAD_INFO_GFP)
+
 /*
  * flag set/clear/test wrappers
  * - pass TIF_xxxx constants to these functions

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [tip:smp/hotplug] fork: Remove the weak insanity
  2012-05-05 15:05 ` [patch 01/18] fork: Remove the weak insanity Thomas Gleixner
  2012-05-05 15:58   ` Sam Ravnborg
@ 2012-05-08 12:31   ` tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 57+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:31 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx

Commit-ID:  6c0a9fa62feb7e9fdefa9720bcc03040c9b0b311
Gitweb:     http://git.kernel.org/tip/6c0a9fa62feb7e9fdefa9720bcc03040c9b0b311
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 5 May 2012 15:05:40 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 13:55:20 +0200

fork: Remove the weak insanity

We error out when compiling with gcc4.1.[01] as it miscompiles
__weak. The workaround with magic defines is not longer
necessary. Make it __weak again.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20120505150141.306358267@linutronix.de

---
 arch/sh/include/asm/thread_info.h  |    1 -
 arch/x86/include/asm/thread_info.h |    1 -
 kernel/fork.c                      |    8 +-------
 3 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
index 20ee40a..09963d4 100644
--- a/arch/sh/include/asm/thread_info.h
+++ b/arch/sh/include/asm/thread_info.h
@@ -98,7 +98,6 @@ static inline struct thread_info *current_thread_info(void)
 extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node);
 extern void free_thread_info(struct thread_info *ti);
 extern void arch_task_cache_init(void);
-#define arch_task_cache_init arch_task_cache_init
 extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
 extern void init_thread_xstate(void);
 
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index ad6df8c..8692a16 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -284,6 +284,5 @@ static inline bool is_ia32_task(void)
 extern void arch_task_cache_init(void);
 extern void free_thread_info(struct thread_info *ti);
 extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
-#define arch_task_cache_init arch_task_cache_init
 #endif
 #endif /* _ASM_X86_THREAD_INFO_H */
diff --git a/kernel/fork.c b/kernel/fork.c
index b9372a0..a79b36e 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -203,13 +203,7 @@ void __put_task_struct(struct task_struct *tsk)
 }
 EXPORT_SYMBOL_GPL(__put_task_struct);
 
-/*
- * macro override instead of weak attribute alias, to workaround
- * gcc 4.1.0 and 4.1.1 bugs with weak attribute and empty functions.
- */
-#ifndef arch_task_cache_init
-#define arch_task_cache_init()
-#endif
+void __init __weak arch_task_cache_init(void) { }
 
 void __init fork_init(unsigned long mempages)
 {

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [tip:smp/hotplug] fork: Move thread info gfp flags to header
  2012-05-05 15:05 ` [patch 03/18] fork: Move thread info gfp flags to header Thomas Gleixner
  2012-05-07  4:34   ` Paul E. McKenney
@ 2012-05-08 12:32   ` tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 57+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:32 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx

Commit-ID:  2889f60814e15dea644782597d897cdba943564f
Gitweb:     http://git.kernel.org/tip/2889f60814e15dea644782597d897cdba943564f
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 5 May 2012 15:05:41 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 13:55:20 +0200

fork: Move thread info gfp flags to header

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 |    6 ++++++
 kernel/fork.c               |    8 ++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index 8d03f07..db78775 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -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
diff --git a/kernel/fork.c b/kernel/fork.c
index a79b36e..5d22b9b 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -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;
 }

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [tip:smp/hotplug] fork: Provide weak arch_release_[ task_struct|thread_info] functions
  2012-05-05 15:05 ` [patch 02/18] fork: Provide weak arch_release_[task_struct|thread_info] functions Thomas Gleixner
@ 2012-05-08 12:33   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 57+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:33 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx

Commit-ID:  41101809a865dd0be1b56eff46c83fad321870b2
Gitweb:     http://git.kernel.org/tip/41101809a865dd0be1b56eff46c83fad321870b2
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 5 May 2012 15:05:41 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 13:55:20 +0200

fork: Provide weak arch_release_[task_struct|thread_info] functions

These functions allow us to move most of the duplicated thread_info
allocators to the core code.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20120505150141.366461660@linutronix.de

---
 kernel/fork.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 5d22b9b..2dfad02 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -112,14 +112,26 @@ int nr_processes(void)
 }
 
 #ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
-# define alloc_task_struct_node(node)		\
-		kmem_cache_alloc_node(task_struct_cachep, GFP_KERNEL, node)
-# 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_node(int node)
+{
+	return kmem_cache_alloc_node(task_struct_cachep, GFP_KERNEL, node);
+}
+
+void __weak arch_release_task_struct(struct task_struct *tsk) { }
+
+static inline void free_task_struct(struct task_struct *tsk)
+{
+	arch_release_task_struct(tsk);
+	kmem_cache_free(task_struct_cachep, tsk);
+}
 #endif
 
 #ifndef __HAVE_ARCH_THREAD_INFO_ALLOCATOR
+
+void __weak arch_release_thread_info(struct thread_info *ti) { }
+
 static struct thread_info *alloc_thread_info_node(struct task_struct *tsk,
 						  int node)
 {
@@ -131,6 +143,7 @@ static struct thread_info *alloc_thread_info_node(struct task_struct *tsk,
 
 static inline void free_thread_info(struct thread_info *ti)
 {
+	arch_release_thread_info(ti);
 	free_pages((unsigned long)ti, THREAD_SIZE_ORDER);
 }
 #endif

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [tip:smp/hotplug] tile: Use common threadinfo allocator
  2012-05-05 15:05 ` [patch 17/18] tile: " Thomas Gleixner
  2012-05-05 15:21   ` Chris Metcalf
@ 2012-05-08 12:34   ` tip-bot for Thomas Gleixner
  2012-05-08 19:02     ` Chris Metcalf
  1 sibling, 1 reply; 57+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:34 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, cmetcalf, tglx

Commit-ID:  d909a81b198a397593495508c4a5755fe95552fb
Gitweb:     http://git.kernel.org/tip/d909a81b198a397593495508c4a5755fe95552fb
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 5 May 2012 15:05:47 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 13:55:20 +0200

tile: Use common threadinfo allocator

Use the core allocator and deal with the extra cleanup in
arch_release_thread_info().

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Link: http://lkml.kernel.org/r/20120505150142.311126440@linutronix.de
---
 arch/tile/include/asm/thread_info.h |    6 ++----
 arch/tile/kernel/process.c          |   23 ++---------------------
 2 files changed, 4 insertions(+), 25 deletions(-)

diff --git a/arch/tile/include/asm/thread_info.h b/arch/tile/include/asm/thread_info.h
index bc4f562..c1cf8a8 100644
--- a/arch/tile/include/asm/thread_info.h
+++ b/arch/tile/include/asm/thread_info.h
@@ -77,16 +77,14 @@ struct thread_info {
 
 #ifndef __ASSEMBLY__
 
+void arch_release_thread_info(struct thread_info *info);
+
 /* How to get the thread information struct from C. */
 register unsigned long stack_pointer __asm__("sp");
 
 #define current_thread_info() \
   ((struct thread_info *)(stack_pointer & -THREAD_SIZE))
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-extern struct thread_info *alloc_thread_info_node(struct task_struct *task, int node);
-extern void free_thread_info(struct thread_info *info);
-
 /* Sit on a nap instruction until interrupted. */
 extern void smp_nap(void);
 
diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c
index 2d5ef61..efb9833 100644
--- a/arch/tile/kernel/process.c
+++ b/arch/tile/kernel/process.c
@@ -114,27 +114,10 @@ void cpu_idle(void)
 	}
 }
 
-struct thread_info *alloc_thread_info_node(struct task_struct *task, int node)
-{
-	struct page *page;
-	gfp_t flags = GFP_KERNEL;
-
-#ifdef CONFIG_DEBUG_STACK_USAGE
-	flags |= __GFP_ZERO;
-#endif
-
-	page = alloc_pages_node(node, flags, THREAD_SIZE_ORDER);
-	if (!page)
-		return NULL;
-
-	return (struct thread_info *)page_address(page);
-}
-
 /*
- * Free a thread_info node, and all of its derivative
- * data structures.
+ * Release a thread_info structure
  */
-void free_thread_info(struct thread_info *info)
+void arch_release_thread_info(struct thread_info *info)
 {
 	struct single_step_state *step_state = info->step_state;
 
@@ -169,8 +152,6 @@ void free_thread_info(struct thread_info *info)
 		 */
 		kfree(step_state);
 	}
-
-	free_pages((unsigned long)info, THREAD_SIZE_ORDER);
 }
 
 static void save_arch_state(struct thread_struct *t);

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [tip:smp/hotplug] fork: Provide kmemcache based thread_info allocator
  2012-05-05 15:05 ` [patch 04/18] fork: Provide kmemcache based thread_info allocator Thomas Gleixner
@ 2012-05-08 12:35   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 57+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:35 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx

Commit-ID:  0d15d74a1ead10673b5b1db66d4c90552769096c
Gitweb:     http://git.kernel.org/tip/0d15d74a1ead10673b5b1db66d4c90552769096c
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 5 May 2012 15:05:41 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 14:08:44 +0200

fork: Provide kmemcache based thread_info allocator

Several architectures have their own kmemcache based thread allocator
because THREAD_SIZE is smaller than PAGE_SIZE. Add it to the core code
conditionally on THREAD_SIZE < PAGE_SIZE so the private copies can go.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20120505150141.491002124@linutronix.de
---
 kernel/fork.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 2dfad02..7590bd6 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -132,6 +132,11 @@ static inline void free_task_struct(struct task_struct *tsk)
 
 void __weak arch_release_thread_info(struct thread_info *ti) { }
 
+/*
+ * Allocate pages if THREAD_SIZE is >= PAGE_SIZE, otherwise use a
+ * kmemcache based allocator.
+ */
+# if THREAD_SIZE >= PAGE_SIZE
 static struct thread_info *alloc_thread_info_node(struct task_struct *tsk,
 						  int node)
 {
@@ -146,6 +151,28 @@ static inline void free_thread_info(struct thread_info *ti)
 	arch_release_thread_info(ti);
 	free_pages((unsigned long)ti, THREAD_SIZE_ORDER);
 }
+# else
+static struct kmem_cache *thread_info_cache;
+
+static struct thread_info *alloc_thread_info_node(struct task_struct *tsk,
+						  int node)
+{
+	return kmem_cache_alloc_node(thread_info_cache, THREADINFO_GFP, node);
+}
+
+static void free_thread_info(struct thread_info *ti)
+{
+	arch_release_thread_info(ti);
+	kmem_cache_free(thread_info_cache, ti);
+}
+
+void thread_info_cache_init(void)
+{
+	thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE,
+					      THREAD_SIZE, 0, NULL);
+	BUG_ON(thread_info_cache == NULL);
+}
+# endif
 #endif
 
 /* SLAB cache for signal_struct structures (tsk->signal) */

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [tip:smp/hotplug] c6x: Use common threadinfo allocator
  2012-05-05 15:05 ` [patch 06/18] c6x: " Thomas Gleixner
  2012-05-07 19:49   ` Mark Salter
@ 2012-05-08 12:36   ` tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 57+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:36 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, msalter

Commit-ID:  7b8fe0570a65486e77823d5fcec9998c2aae9970
Gitweb:     http://git.kernel.org/tip/7b8fe0570a65486e77823d5fcec9998c2aae9970
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 5 May 2012 15:05:42 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 14:08:44 +0200

c6x: Use common threadinfo allocator

There is no functional difference. __get_free_pages() ends up calling
alloc_pages_node().

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Mark Salter <msalter@redhat.com>
Link: http://lkml.kernel.org/r/20120505150141.621728944@linutronix.de
---
 arch/c6x/include/asm/thread_info.h |   17 ++---------------
 1 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/arch/c6x/include/asm/thread_info.h b/arch/c6x/include/asm/thread_info.h
index fd99148..1710bcb 100644
--- a/arch/c6x/include/asm/thread_info.h
+++ b/arch/c6x/include/asm/thread_info.h
@@ -20,11 +20,11 @@
 #ifdef CONFIG_4KSTACKS
 #define THREAD_SIZE		4096
 #define THREAD_SHIFT		12
-#define THREAD_ORDER		0
+#define THREAD_SIZE_ORDER	0
 #else
 #define THREAD_SIZE		8192
 #define THREAD_SHIFT		13
-#define THREAD_ORDER		1
+#define THREAD_SIZE_ORDER	1
 #endif
 
 #define THREAD_START_SP		(THREAD_SIZE - 8)
@@ -80,19 +80,6 @@ struct thread_info *current_thread_info(void)
 	return ti;
 }
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
-/* thread information allocation */
-#ifdef CONFIG_DEBUG_STACK_USAGE
-#define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO)
-#else
-#define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK)
-#endif
-
-#define alloc_thread_info_node(tsk, node)	\
-	((struct thread_info *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER))
-
-#define free_thread_info(ti)	free_pages((unsigned long) (ti), THREAD_ORDER)
 #define get_thread_info(ti)	get_task_struct((ti)->task)
 #define put_thread_info(ti)	put_task_struct((ti)->task)
 #endif /* __ASSEMBLY__ */

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [tip:smp/hotplug] x86: Use common threadinfo allocator
  2012-05-05 15:05 ` [patch 05/18] x86: Use common threadinfo allocator Thomas Gleixner
@ 2012-05-08 12:37   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 57+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:37 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx

Commit-ID:  38e7c572ce7310def003d8bb7c34260f5d8118cb
Gitweb:     http://git.kernel.org/tip/38e7c572ce7310def003d8bb7c34260f5d8118cb
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 5 May 2012 15:05:42 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 14:08:44 +0200

x86: Use common threadinfo allocator

The only difference is the free_thread_info function, which frees
xstate.

Use the new arch_release_task_struct() function instead and switch
over to the core allocator.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20120505150141.559556763@linutronix.de
Cc: x86@kernel.org
---
 arch/x86/include/asm/boot.h          |    2 +-
 arch/x86/include/asm/page_32_types.h |    4 ++--
 arch/x86/include/asm/page_64_types.h |    4 ++--
 arch/x86/include/asm/thread_info.h   |   20 +-------------------
 arch/x86/kernel/irq_32.c             |    8 ++++----
 arch/x86/kernel/process.c            |    5 ++---
 6 files changed, 12 insertions(+), 31 deletions(-)

diff --git a/arch/x86/include/asm/boot.h b/arch/x86/include/asm/boot.h
index 5e1a2ee..b13fe63 100644
--- a/arch/x86/include/asm/boot.h
+++ b/arch/x86/include/asm/boot.h
@@ -19,7 +19,7 @@
 #ifdef CONFIG_X86_64
 #define MIN_KERNEL_ALIGN_LG2	PMD_SHIFT
 #else
-#define MIN_KERNEL_ALIGN_LG2	(PAGE_SHIFT + THREAD_ORDER)
+#define MIN_KERNEL_ALIGN_LG2	(PAGE_SHIFT + THREAD_SIZE_ORDER)
 #endif
 #define MIN_KERNEL_ALIGN	(_AC(1, UL) << MIN_KERNEL_ALIGN_LG2)
 
diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h
index ade619f..ef17af0 100644
--- a/arch/x86/include/asm/page_32_types.h
+++ b/arch/x86/include/asm/page_32_types.h
@@ -15,8 +15,8 @@
  */
 #define __PAGE_OFFSET		_AC(CONFIG_PAGE_OFFSET, UL)
 
-#define THREAD_ORDER	1
-#define THREAD_SIZE 	(PAGE_SIZE << THREAD_ORDER)
+#define THREAD_SIZE_ORDER	1
+#define THREAD_SIZE		(PAGE_SIZE << THREAD_SIZE_ORDER)
 
 #define STACKFAULT_STACK 0
 #define DOUBLEFAULT_STACK 1
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h
index 7639dbf..320f7bb 100644
--- a/arch/x86/include/asm/page_64_types.h
+++ b/arch/x86/include/asm/page_64_types.h
@@ -1,8 +1,8 @@
 #ifndef _ASM_X86_PAGE_64_DEFS_H
 #define _ASM_X86_PAGE_64_DEFS_H
 
-#define THREAD_ORDER	1
-#define THREAD_SIZE  (PAGE_SIZE << THREAD_ORDER)
+#define THREAD_SIZE_ORDER	1
+#define THREAD_SIZE  (PAGE_SIZE << THREAD_SIZE_ORDER)
 #define CURRENT_MASK (~(THREAD_SIZE - 1))
 
 #define EXCEPTION_STACK_ORDER 0
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index 8692a16..73cfe0d 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -155,24 +155,6 @@ struct thread_info {
 
 #define PREEMPT_ACTIVE		0x10000000
 
-/* thread information allocation */
-#ifdef CONFIG_DEBUG_STACK_USAGE
-#define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO)
-#else
-#define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK)
-#endif
-
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
-#define alloc_thread_info_node(tsk, node)				\
-({									\
-	struct page *page = alloc_pages_node(node, THREAD_FLAGS,	\
-					     THREAD_ORDER);		\
-	struct thread_info *ret = page ? page_address(page) : NULL;	\
-									\
-	ret;								\
-})
-
 #ifdef CONFIG_X86_32
 
 #define STACK_WARN	(THREAD_SIZE/8)
@@ -282,7 +264,7 @@ static inline bool is_ia32_task(void)
 
 #ifndef __ASSEMBLY__
 extern void arch_task_cache_init(void);
-extern void free_thread_info(struct thread_info *ti);
 extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
+extern void arch_release_task_struct(struct task_struct *tsk);
 #endif
 #endif /* _ASM_X86_THREAD_INFO_H */
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 58b7f27..344faf8 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -127,8 +127,8 @@ void __cpuinit irq_ctx_init(int cpu)
 		return;
 
 	irqctx = page_address(alloc_pages_node(cpu_to_node(cpu),
-					       THREAD_FLAGS,
-					       THREAD_ORDER));
+					       THREADINFO_GFP,
+					       THREAD_SIZE_ORDER));
 	memset(&irqctx->tinfo, 0, sizeof(struct thread_info));
 	irqctx->tinfo.cpu		= cpu;
 	irqctx->tinfo.preempt_count	= HARDIRQ_OFFSET;
@@ -137,8 +137,8 @@ void __cpuinit irq_ctx_init(int cpu)
 	per_cpu(hardirq_ctx, cpu) = irqctx;
 
 	irqctx = page_address(alloc_pages_node(cpu_to_node(cpu),
-					       THREAD_FLAGS,
-					       THREAD_ORDER));
+					       THREADINFO_GFP,
+					       THREAD_SIZE_ORDER));
 	memset(&irqctx->tinfo, 0, sizeof(struct thread_info));
 	irqctx->tinfo.cpu		= cpu;
 	irqctx->tinfo.addr_limit	= MAKE_MM_SEG(0);
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 8215458..e817315 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -76,10 +76,9 @@ void free_thread_xstate(struct task_struct *tsk)
 	fpu_free(&tsk->thread.fpu);
 }
 
-void free_thread_info(struct thread_info *ti)
+void arch_release_task_struct(struct task_struct *tsk)
 {
-	free_thread_xstate(ti->task);
-	free_pages((unsigned long)ti, THREAD_ORDER);
+	free_thread_xstate(tsk);
 }
 
 void arch_task_cache_init(void)

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [tip:smp/hotplug] cris: Use common threadinfo allocator
  2012-05-05 15:05 ` [patch 07/18] cris: " Thomas Gleixner
@ 2012-05-08 12:37   ` tip-bot for Thomas Gleixner
  2012-05-15 12:49   ` [patch 07/18] " Jesper Nilsson
  1 sibling, 0 replies; 57+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:37 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, jesper.nilsson, tglx

Commit-ID:  803fc74f06cf3cd23417463ca5a176b41717ec19
Gitweb:     http://git.kernel.org/tip/803fc74f06cf3cd23417463ca5a176b41717ec19
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 5 May 2012 15:05:43 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 14:08:44 +0200

cris: Use common threadinfo allocator

There is no functional difference. __get_free_pages() ends up calling
alloc_pages_node().

This also allocates only one page which matches THREAD_SIZE instead of
an extra page for nothing.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Link: http://lkml.kernel.org/r/20120505150141.681236240@linutronix.de
---
 arch/cris/include/asm/processor.h   |    5 ++---
 arch/cris/include/asm/thread_info.h |    6 ------
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/arch/cris/include/asm/processor.h b/arch/cris/include/asm/processor.h
index 4210d72..8dc56ef 100644
--- a/arch/cris/include/asm/processor.h
+++ b/arch/cris/include/asm/processor.h
@@ -25,13 +25,12 @@ struct task_struct;
  */
 #define TASK_UNMAPPED_BASE      (PAGE_ALIGN(TASK_SIZE / 3))
 
-/* THREAD_SIZE is the size of the task_struct/kernel_stack combo.
+/* THREAD_SIZE is the size of the thread_info/kernel_stack combo.
  * normally, the stack is found by doing something like p + THREAD_SIZE
  * in CRIS, a page is 8192 bytes, which seems like a sane size
  */
-
 #define THREAD_SIZE       PAGE_SIZE
-#define KERNEL_STACK_SIZE PAGE_SIZE
+#define THREAD_SIZE_ORDER (0)
 
 /*
  * At user->kernel entry, the pt_regs struct is stacked on the top of the kernel-stack.
diff --git a/arch/cris/include/asm/thread_info.h b/arch/cris/include/asm/thread_info.h
index 29b9288..5b1c448 100644
--- a/arch/cris/include/asm/thread_info.h
+++ b/arch/cris/include/asm/thread_info.h
@@ -65,12 +65,6 @@ struct thread_info {
 
 #define init_thread_info	(init_thread_union.thread_info)
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-/* thread information allocation */
-#define alloc_thread_info_node(tsk, node)	\
-	((struct thread_info *) __get_free_pages(GFP_KERNEL, 1))
-#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
-
 #endif /* !__ASSEMBLY__ */
 
 /*

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [tip:smp/hotplug] frv: Use common threadinfo allocator
  2012-05-05 15:05 ` [patch 08/18] frv: " Thomas Gleixner
@ 2012-05-08 12:38   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 57+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:38 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, dhowells, tglx

Commit-ID:  c64872cd0dd5892f4d6f3605ffca36d13e63443d
Gitweb:     http://git.kernel.org/tip/c64872cd0dd5892f4d6f3605ffca36d13e63443d
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 5 May 2012 15:05:43 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 14:08:44 +0200

frv: Use common threadinfo allocator

The core now has a threadinfo allocator which uses a kmemcache when
THREAD_SIZE < PAGE_SIZE.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: David Howells <dhowells@redhat.com>
Link: http://lkml.kernel.org/r/20120505150141.751600045@linutronix.de

---
 arch/frv/include/asm/thread_info.h |   13 -------------
 1 files changed, 0 insertions(+), 13 deletions(-)

diff --git a/arch/frv/include/asm/thread_info.h b/arch/frv/include/asm/thread_info.h
index aaea388..54ab13a 100644
--- a/arch/frv/include/asm/thread_info.h
+++ b/arch/frv/include/asm/thread_info.h
@@ -80,19 +80,6 @@ register struct thread_info *__current_thread_info asm("gr15");
 
 #define current_thread_info() ({ __current_thread_info; })
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
-/* thread information allocation */
-#ifdef CONFIG_DEBUG_STACK_USAGE
-#define alloc_thread_info_node(tsk, node)			\
-		kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
-#else
-#define alloc_thread_info_node(tsk, node)			\
-		kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
-#endif
-
-#define free_thread_info(info)	kfree(info)
-
 #endif /* __ASSEMBLY__ */
 
 /*

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [tip:smp/hotplug] m32r: Use common threadinfo allocator
  2012-05-05 15:05 ` [patch 10/18] m32r: " Thomas Gleixner
@ 2012-05-08 12:39   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 57+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:39 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, takata, tglx

Commit-ID:  e6e9c540d5d177e7a40d8b40a3b2386bdefbe5da
Gitweb:     http://git.kernel.org/tip/e6e9c540d5d177e7a40d8b40a3b2386bdefbe5da
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 5 May 2012 15:05:44 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 14:08:45 +0200

m32r: Use common threadinfo allocator

No reason why m32r needs to use kmalloc to allocate 2 pages instead of
using the core allocator.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Link: http://lkml.kernel.org/r/20120505150141.875430830@linutronix.de
---
 arch/m32r/include/asm/thread_info.h |   17 ++---------------
 1 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/arch/m32r/include/asm/thread_info.h b/arch/m32r/include/asm/thread_info.h
index bf8fa3c..c083f60 100644
--- a/arch/m32r/include/asm/thread_info.h
+++ b/arch/m32r/include/asm/thread_info.h
@@ -55,8 +55,8 @@ struct thread_info {
 
 #define PREEMPT_ACTIVE		0x10000000
 
-#define THREAD_SIZE (PAGE_SIZE << 1)
-
+#define THREAD_SIZE		(PAGE_SIZE << 1)
+#define THREAD_SIZE_ORDER	1
 /*
  * macros/functions for gaining access to the thread information structure
  */
@@ -92,19 +92,6 @@ static inline struct thread_info *current_thread_info(void)
 	return ti;
 }
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
-/* thread information allocation */
-#ifdef CONFIG_DEBUG_STACK_USAGE
-#define alloc_thread_info_node(tsk, node)			\
-		kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
-#else
-#define alloc_thread_info_node(tsk, node)			\
-		kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
-#endif
-
-#define free_thread_info(info) kfree(info)
-
 #define TI_FLAG_FAULT_CODE_SHIFT	28
 
 static inline void set_thread_fault_code(unsigned int val)

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [tip:smp/hotplug] hexagon: Use common threadinfo allocator
  2012-05-05 15:05 ` [patch 09/18] hexagon: " Thomas Gleixner
@ 2012-05-08 12:40   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 57+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:40 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, rkuo

Commit-ID:  fe844052bca4355bf1a1b078d3e7727800cf3c73
Gitweb:     http://git.kernel.org/tip/fe844052bca4355bf1a1b078d3e7727800cf3c73
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 5 May 2012 15:05:44 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 14:08:45 +0200

hexagon: Use common threadinfo allocator

The core now has a threadinfo allocator which uses a kmemcache when
THREAD_SIZE < PAGE_SIZE.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Richard Kuo <rkuo@codeaurora.org>
Link: http://lkml.kernel.org/r/20120505150141.812612113@linutronix.de
---
 arch/hexagon/include/asm/thread_info.h |    8 -------
 arch/hexagon/kernel/process.c          |   37 --------------------------------
 2 files changed, 0 insertions(+), 45 deletions(-)

diff --git a/arch/hexagon/include/asm/thread_info.h b/arch/hexagon/include/asm/thread_info.h
index 9c2934f..4f936a7 100644
--- a/arch/hexagon/include/asm/thread_info.h
+++ b/arch/hexagon/include/asm/thread_info.h
@@ -31,15 +31,7 @@
 
 #define THREAD_SHIFT		12
 #define THREAD_SIZE		(1<<THREAD_SHIFT)
-
-#if THREAD_SHIFT >= PAGE_SHIFT
 #define THREAD_SIZE_ORDER	(THREAD_SHIFT - PAGE_SHIFT)
-#else  /*  don't use standard allocator  */
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node);
-extern void free_thread_info(struct thread_info *ti);
-#endif
-
 
 #ifndef __ASSEMBLY__
 
diff --git a/arch/hexagon/kernel/process.c b/arch/hexagon/kernel/process.c
index ff02821..af51de6 100644
--- a/arch/hexagon/kernel/process.c
+++ b/arch/hexagon/kernel/process.c
@@ -234,43 +234,6 @@ unsigned long get_wchan(struct task_struct *p)
 }
 
 /*
- * Borrowed from PowerPC -- basically allow smaller kernel stacks if we
- * go crazy with the page sizes.
- */
-#if THREAD_SHIFT < PAGE_SHIFT
-
-static struct kmem_cache *thread_info_cache;
-
-struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node)
-{
-	struct thread_info *ti;
-
-	ti = kmem_cache_alloc_node(thread_info_cache, GFP_KERNEL, node);
-	if (unlikely(ti == NULL))
-		return NULL;
-#ifdef CONFIG_DEBUG_STACK_USAGE
-	memset(ti, 0, THREAD_SIZE);
-#endif
-	return ti;
-}
-
-void free_thread_info(struct thread_info *ti)
-{
-	kmem_cache_free(thread_info_cache, ti);
-}
-
-/*  Weak symbol; called by init/main.c  */
-
-void thread_info_cache_init(void)
-{
-	thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE,
-					      THREAD_SIZE, 0, NULL);
-	BUG_ON(thread_info_cache == NULL);
-}
-
-#endif /* THREAD_SHIFT < PAGE_SHIFT */
-
-/*
  * Required placeholder.
  */
 int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [tip:smp/hotplug] mips: Use common threadinfo allocator
  2012-05-05 15:05 ` [patch 11/18] mips: " Thomas Gleixner
@ 2012-05-08 12:41   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 57+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:41 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, ralf, tglx

Commit-ID:  3194f61de93d4d4fbc2f2ddb25aeded6f9cebaeb
Gitweb:     http://git.kernel.org/tip/3194f61de93d4d4fbc2f2ddb25aeded6f9cebaeb
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 5 May 2012 15:05:44 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 14:08:45 +0200

mips: Use common threadinfo allocator

No point in using kmalloc for allocating 0, 1 resp. 2 pages for
threadinfo.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ralf Baechle <ralf@linux-mips.org>
Link: http://lkml.kernel.org/r/20120505150141.936950979@linutronix.de
---
 arch/mips/include/asm/thread_info.h |   12 ------------
 1 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
index 0d85d8e..e2eca7d 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
@@ -85,18 +85,6 @@ register struct thread_info *__current_thread_info __asm__("$28");
 
 #define STACK_WARN	(THREAD_SIZE / 8)
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
-#ifdef CONFIG_DEBUG_STACK_USAGE
-#define alloc_thread_info_node(tsk, node) \
-		kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
-#else
-#define alloc_thread_info_node(tsk, node) \
-		kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
-#endif
-
-#define free_thread_info(info) kfree(info)
-
 #endif /* !__ASSEMBLY__ */
 
 #define PREEMPT_ACTIVE		0x10000000

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [tip:smp/hotplug] powerpc: Use common threadinfo allocator
  2012-05-05 15:05 ` [patch 13/18] powerpc: " Thomas Gleixner
@ 2012-05-08 12:42   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 57+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:42 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, benh, tglx

Commit-ID:  96c951179736eb59c5f66de2ac85af9e7a6a8b15
Gitweb:     http://git.kernel.org/tip/96c951179736eb59c5f66de2ac85af9e7a6a8b15
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 5 May 2012 15:05:45 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 14:08:45 +0200

powerpc: Use common threadinfo allocator

The core now has a threadinfo allocator which uses a kmemcache when
THREAD_SIZE < PAGE_SIZE.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Link: http://lkml.kernel.org/r/20120505150142.059161130@linutronix.de
---
 arch/powerpc/include/asm/thread_info.h |   13 -------------
 arch/powerpc/kernel/process.c          |   31 -------------------------------
 2 files changed, 0 insertions(+), 44 deletions(-)

diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index 4a741c7..1a1bb00 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -62,21 +62,8 @@ struct thread_info {
 #define init_thread_info	(init_thread_union.thread_info)
 #define init_stack		(init_thread_union.stack)
 
-/* thread information allocation */
-
-#if THREAD_SHIFT >= PAGE_SHIFT
-
 #define THREAD_SIZE_ORDER	(THREAD_SHIFT - PAGE_SHIFT)
 
-#else /* THREAD_SHIFT < PAGE_SHIFT */
-
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
-extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node);
-extern void free_thread_info(struct thread_info *ti);
-
-#endif /* THREAD_SHIFT < PAGE_SHIFT */
-
 /* how to get the thread information struct from C */
 static inline struct thread_info *current_thread_info(void)
 {
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 4937c96..aa05935 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1252,37 +1252,6 @@ void __ppc64_runlatch_off(void)
 }
 #endif /* CONFIG_PPC64 */
 
-#if THREAD_SHIFT < PAGE_SHIFT
-
-static struct kmem_cache *thread_info_cache;
-
-struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node)
-{
-	struct thread_info *ti;
-
-	ti = kmem_cache_alloc_node(thread_info_cache, GFP_KERNEL, node);
-	if (unlikely(ti == NULL))
-		return NULL;
-#ifdef CONFIG_DEBUG_STACK_USAGE
-	memset(ti, 0, THREAD_SIZE);
-#endif
-	return ti;
-}
-
-void free_thread_info(struct thread_info *ti)
-{
-	kmem_cache_free(thread_info_cache, ti);
-}
-
-void thread_info_cache_init(void)
-{
-	thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE,
-					      THREAD_SIZE, 0, NULL);
-	BUG_ON(thread_info_cache == NULL);
-}
-
-#endif /* THREAD_SHIFT < PAGE_SHIFT */
-
 unsigned long arch_align_stack(unsigned long sp)
 {
 	if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [tip:smp/hotplug] mn10300: Use common threadinfo allocator
  2012-05-05 15:05 ` [patch 12/18] mn10300: " Thomas Gleixner
@ 2012-05-08 12:42   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 57+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:42 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, dhowells, tglx

Commit-ID:  c03a6a7ba6f456663e4b254cdde460b24c0852e1
Gitweb:     http://git.kernel.org/tip/c03a6a7ba6f456663e4b254cdde460b24c0852e1
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 5 May 2012 15:05:45 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 14:08:45 +0200

mn10300: Use common threadinfo allocator

Let the core code allocate and handle the kgdb cleanup with the
arch_release_thread_info() function.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: David Howells <dhowells@redhat.com>
Link: http://lkml.kernel.org/r/20120505150141.996582377@linutronix.de
---
 arch/mn10300/include/asm/thread_info.h |   17 +++--------------
 arch/mn10300/kernel/kgdb.c             |    3 +--
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/arch/mn10300/include/asm/thread_info.h b/arch/mn10300/include/asm/thread_info.h
index 28cf521..08251d6 100644
--- a/arch/mn10300/include/asm/thread_info.h
+++ b/arch/mn10300/include/asm/thread_info.h
@@ -20,8 +20,10 @@
 
 #ifdef CONFIG_4KSTACKS
 #define THREAD_SIZE		(4096)
+#define THREAD_SIZE_ORDER	(0)
 #else
 #define THREAD_SIZE		(8192)
+#define THREAD_SIZE_ORDER	(1)
 #endif
 
 #define STACK_WARN		(THREAD_SIZE / 8)
@@ -120,21 +122,8 @@ static inline unsigned long current_stack_pointer(void)
 	return sp;
 }
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
-/* thread information allocation */
-#ifdef CONFIG_DEBUG_STACK_USAGE
-#define alloc_thread_info_node(tsk, node)			\
-		kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
-#else
-#define alloc_thread_info_node(tsk, node)			\
-		kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
-#endif
-
 #ifndef CONFIG_KGDB
-#define free_thread_info(ti)	kfree((ti))
-#else
-extern void free_thread_info(struct thread_info *);
+void arch_release_thread_info(struct thread_info *ti)
 #endif
 #define get_thread_info(ti)	get_task_struct((ti)->task)
 #define put_thread_info(ti)	put_task_struct((ti)->task)
diff --git a/arch/mn10300/kernel/kgdb.c b/arch/mn10300/kernel/kgdb.c
index f6c981d..9977082 100644
--- a/arch/mn10300/kernel/kgdb.c
+++ b/arch/mn10300/kernel/kgdb.c
@@ -397,7 +397,7 @@ static bool kgdb_arch_undo_singlestep(struct pt_regs *regs)
  * single-step state is cleared.  At this point the breakpoints should have
  * been removed by __switch_to().
  */
-void free_thread_info(struct thread_info *ti)
+void arch_release_thread_info(struct thread_info *ti)
 {
 	if (kgdb_sstep_thread == ti) {
 		kgdb_sstep_thread = NULL;
@@ -407,7 +407,6 @@ void free_thread_info(struct thread_info *ti)
 		 * so force immediate reentry */
 		kgdb_breakpoint();
 	}
-	kfree(ti);
 }
 
 /*

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [tip:smp/hotplug] sh-use-common-threadinfo-allocator
  2012-05-05 15:05 ` [patch 15/18] sh: " Thomas Gleixner
@ 2012-05-08 12:43   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 57+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:43 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, lethal, tglx

Commit-ID:  df9a7b9b5d1a5ef8cd3474d0cea2c6428542e288
Gitweb:     http://git.kernel.org/tip/df9a7b9b5d1a5ef8cd3474d0cea2c6428542e288
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 5 May 2012 15:05:46 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 14:08:45 +0200

sh-use-common-threadinfo-allocator

The core now has a threadinfo allocator which uses a kmemcache when
THREAD_SIZE < PAGE_SIZE.

Deal with the xstate cleanup in the new arch_release_task_struct()
function.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Paul Mundt <lethal@linux-sh.org>
Link: http://lkml.kernel.org/r/20120505150142.189348931@linutronix.de
---
 arch/sh/include/asm/thread_info.h |   10 +-------
 arch/sh/kernel/process.c          |   46 +-----------------------------------
 2 files changed, 3 insertions(+), 53 deletions(-)

diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
index 09963d4..b690206 100644
--- a/arch/sh/include/asm/thread_info.h
+++ b/arch/sh/include/asm/thread_info.h
@@ -88,21 +88,13 @@ static inline struct thread_info *current_thread_info(void)
 	return ti;
 }
 
-/* thread information allocation */
-#if THREAD_SHIFT >= PAGE_SHIFT
-
 #define THREAD_SIZE_ORDER	(THREAD_SHIFT - PAGE_SHIFT)
 
-#endif
-
-extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node);
-extern void free_thread_info(struct thread_info *ti);
 extern void arch_task_cache_init(void);
 extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
+extern void arch_release_task_struct(struct task_struct *tsk);
 extern void init_thread_xstate(void);
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
 #endif /* __ASSEMBLY__ */
 
 /*
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index 325f98b..f2621ab 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -29,52 +29,10 @@ void free_thread_xstate(struct task_struct *tsk)
 	}
 }
 
-#if THREAD_SHIFT < PAGE_SHIFT
-static struct kmem_cache *thread_info_cache;
-
-struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node)
-{
-	struct thread_info *ti;
-#ifdef CONFIG_DEBUG_STACK_USAGE
-	gfp_t mask = GFP_KERNEL | __GFP_ZERO;
-#else
-	gfp_t mask = GFP_KERNEL;
-#endif
-
-	ti = kmem_cache_alloc_node(thread_info_cache, mask, node);
-	return ti;
-}
-
-void free_thread_info(struct thread_info *ti)
-{
-	free_thread_xstate(ti->task);
-	kmem_cache_free(thread_info_cache, ti);
-}
-
-void thread_info_cache_init(void)
-{
-	thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE,
-					      THREAD_SIZE, SLAB_PANIC, NULL);
-}
-#else
-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);
-
-	return page ? page_address(page) : NULL;
-}
-
-void free_thread_info(struct thread_info *ti)
+void arch_release_task_struct(struct task_struct *tsk)
 {
-	free_thread_xstate(ti->task);
-	free_pages((unsigned long)ti, THREAD_SIZE_ORDER);
+	free_thread_xstate(tsk);
 }
-#endif /* THREAD_SHIFT < PAGE_SHIFT */
 
 void arch_task_cache_init(void)
 {

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [tip:smp/hotplug] score: Use common threadinfo allocator
  2012-05-05 15:05 ` [patch 14/18] score: " Thomas Gleixner
@ 2012-05-08 12:44   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 57+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:44 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, lennox.wu, tglx

Commit-ID:  c4e26890ff4cb4e85969b1e8565af4b046ce03b8
Gitweb:     http://git.kernel.org/tip/c4e26890ff4cb4e85969b1e8565af4b046ce03b8
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 5 May 2012 15:05:46 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 14:08:46 +0200

score: Use common threadinfo allocator

No point in using kmalloc for allocating 2 pages.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Lennox Wu <lennox.wu@gmail.com>
Link: http://lkml.kernel.org/r/20120505150142.123383955@linutronix.de
---
 arch/score/include/asm/thread_info.h |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/score/include/asm/thread_info.h b/arch/score/include/asm/thread_info.h
index 2205c62..a18006e9 100644
--- a/arch/score/include/asm/thread_info.h
+++ b/arch/score/include/asm/thread_info.h
@@ -11,10 +11,9 @@
 #include <linux/const.h>
 
 /* thread information allocation */
-#define THREAD_SIZE_ORDER 	(1)
-#define THREAD_SIZE 		(PAGE_SIZE << THREAD_SIZE_ORDER)
-#define THREAD_MASK 		(THREAD_SIZE - _AC(1,UL))
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
+#define THREAD_SIZE_ORDER	(1)
+#define THREAD_SIZE		(PAGE_SIZE << THREAD_SIZE_ORDER)
+#define THREAD_MASK		(THREAD_SIZE - _AC(1,UL))
 
 #ifndef __ASSEMBLY__
 
@@ -71,9 +70,6 @@ struct thread_info {
 register struct thread_info *__current_thread_info __asm__("r28");
 #define current_thread_info()	__current_thread_info
 
-#define alloc_thread_info_node(tsk, node) kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
-#define free_thread_info(info) kfree(info)
-
 #endif /* !__ASSEMBLY__ */
 
 #define PREEMPT_ACTIVE		0x10000000

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [tip:smp/hotplug] sparc: Use common threadinfo allocator
  2012-05-05 15:05 ` [patch 16/18] sparc: Use common threadinfo allocator Thomas Gleixner
  2012-05-06 17:03   ` David Miller
@ 2012-05-08 12:45   ` tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 57+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:45 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, davem

Commit-ID:  66bb4cda55477efeb1be5c2cbd3785a69b088a8a
Gitweb:     http://git.kernel.org/tip/66bb4cda55477efeb1be5c2cbd3785a69b088a8a
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 5 May 2012 15:05:47 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 14:08:46 +0200

sparc: Use common threadinfo allocator

Exaclty the same as the core code.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: David S. Miller <davem@davemloft.net>
Link: http://lkml.kernel.org/r/20120505150142.252861878@linutronix.de
---
 arch/sparc/include/asm/thread_info_64.h |   25 ++-----------------------
 1 files changed, 2 insertions(+), 23 deletions(-)

diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
index 01d057f..7f0981b 100644
--- a/arch/sparc/include/asm/thread_info_64.h
+++ b/arch/sparc/include/asm/thread_info_64.h
@@ -138,32 +138,11 @@ register struct thread_info *current_thread_info_reg asm("g6");
 
 /* thread information allocation */
 #if PAGE_SHIFT == 13
-#define __THREAD_INFO_ORDER	1
+#define THREAD_SIZE_ORDER	1
 #else /* PAGE_SHIFT == 13 */
-#define __THREAD_INFO_ORDER	0
+#define THREAD_SIZE_ORDER	0
 #endif /* PAGE_SHIFT == 13 */
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
-#ifdef CONFIG_DEBUG_STACK_USAGE
-#define THREAD_FLAGS (GFP_KERNEL | __GFP_ZERO)
-#else
-#define THREAD_FLAGS (GFP_KERNEL)
-#endif
-
-#define alloc_thread_info_node(tsk, node)				\
-({									\
-	struct page *page = alloc_pages_node(node, THREAD_FLAGS,	\
-					     __THREAD_INFO_ORDER);	\
-	struct thread_info *ret;					\
-									\
-	ret = page ? page_address(page) : NULL;				\
-	ret;								\
-})
-
-#define free_thread_info(ti) \
-	free_pages((unsigned long)(ti),__THREAD_INFO_ORDER)
-
 #define __thread_flag_byte_ptr(ti)	\
 	((unsigned char *)(&((ti)->flags)))
 #define __cur_thread_flag_byte_ptr	__thread_flag_byte_ptr(current_thread_info())

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [tip:smp/hotplug] task_allocator: Use config switches instead of magic defines
  2012-05-05 15:05 ` [patch 18/18] task_allocator: Use config switches instead of magic defines Thomas Gleixner
  2012-05-07 20:32   ` Sam Ravnborg
@ 2012-05-08 12:46   ` tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 57+ messages in thread
From: tip-bot for Thomas Gleixner @ 2012-05-08 12:46 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, sam, tony.luck, tglx

Commit-ID:  f5e10287367dcffb5504d19c83e85ca041ca2596
Gitweb:     http://git.kernel.org/tip/f5e10287367dcffb5504d19c83e85ca041ca2596
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 5 May 2012 15:05:48 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 14:08:46 +0200

task_allocator: Use config switches instead of magic defines

Replace __HAVE_ARCH_TASK_ALLOCATOR and __HAVE_ARCH_THREAD_ALLOCATOR
with proper config switches.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Tony Luck <tony.luck@intel.com>
Link: http://lkml.kernel.org/r/20120505150142.371309416@linutronix.de
---
 arch/Kconfig                            |    8 ++++++++
 arch/ia64/Kconfig                       |    2 ++
 arch/ia64/include/asm/thread_info.h     |    3 ---
 arch/sparc/Kconfig                      |    1 +
 arch/sparc/include/asm/thread_info_32.h |    2 --
 kernel/fork.c                           |    7 +++----
 6 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 597b132..bd265a2 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -152,6 +152,14 @@ config GENERIC_SMP_IDLE_THREAD
 config ARCH_INIT_TASK
        bool
 
+# Select if arch has its private alloc_task_struct() function
+config ARCH_TASK_STRUCT_ALLOCATOR
+	bool
+
+# Select if arch has its private alloc_thread_info() function
+config ARCH_THREAD_INFO_ALLOCATOR
+	bool
+
 config HAVE_REGS_AND_STACK_ACCESS_API
 	bool
 	help
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 022ea3a..ba667b6 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -35,6 +35,8 @@ config IA64
 	select GENERIC_IOMAP
 	select GENERIC_SMP_IDLE_THREAD
 	select ARCH_INIT_TASK
+	select ARCH_TASK_STRUCT_ALLOCATOR
+	select ARCH_THREAD_INFO_ALLOCATOR
 	default y
 	help
 	  The Itanium Processor Family is Intel's 64-bit successor to
diff --git a/arch/ia64/include/asm/thread_info.h b/arch/ia64/include/asm/thread_info.h
index e054bcc..310d973 100644
--- a/arch/ia64/include/asm/thread_info.h
+++ b/arch/ia64/include/asm/thread_info.h
@@ -54,8 +54,6 @@ struct thread_info {
 	},					\
 }
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
 #ifndef ASM_OFFSETS_C
 /* how to get the thread information struct from C */
 #define current_thread_info()	((struct thread_info *) ((char *) current + IA64_TASK_SIZE))
@@ -84,7 +82,6 @@ struct thread_info {
 #endif
 #define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET)
 
-#define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
 #define alloc_task_struct_node(node)						\
 ({										\
 	struct page *page = alloc_pages_node(node, GFP_KERNEL | __GFP_COMP,	\
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index e417f35..ec0347a 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -36,6 +36,7 @@ config SPARC32
 	def_bool !64BIT
 	select GENERIC_ATOMIC64
 	select CLZ_TAB
+	select ARCH_THREAD_INFO_ALLOCATOR
 
 config SPARC64
 	def_bool 64BIT
diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h
index c2a1080..b29498d 100644
--- a/arch/sparc/include/asm/thread_info_32.h
+++ b/arch/sparc/include/asm/thread_info_32.h
@@ -80,8 +80,6 @@ register struct thread_info *current_thread_info_reg asm("g6");
  */
 #define THREAD_INFO_ORDER  1
 
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
 BTFIXUPDEF_CALL(struct thread_info *, alloc_thread_info_node, int)
 #define alloc_thread_info_node(tsk, node) BTFIXUP_CALL(alloc_thread_info_node)(node)
 
diff --git a/kernel/fork.c b/kernel/fork.c
index 7590bd6..a1793e4 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -111,7 +111,7 @@ int nr_processes(void)
 	return total;
 }
 
-#ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
+#ifndef CONFIG_ARCH_TASK_STRUCT_ALLOCATOR
 static struct kmem_cache *task_struct_cachep;
 
 static inline struct task_struct *alloc_task_struct_node(int node)
@@ -128,8 +128,7 @@ static inline void free_task_struct(struct task_struct *tsk)
 }
 #endif
 
-#ifndef __HAVE_ARCH_THREAD_INFO_ALLOCATOR
-
+#ifndef CONFIG_ARCH_THREAD_INFO_ALLOCATOR
 void __weak arch_release_thread_info(struct thread_info *ti) { }
 
 /*
@@ -243,7 +242,7 @@ void __init __weak arch_task_cache_init(void) { }
 
 void __init fork_init(unsigned long mempages)
 {
-#ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
+#ifndef CONFIG_ARCH_TASK_STRUCT_ALLOCATOR
 #ifndef ARCH_MIN_TASKALIGN
 #define ARCH_MIN_TASKALIGN	L1_CACHE_BYTES
 #endif

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* Re: [patch 03/18] fork: Move thread info gfp flags to header
  2012-05-07 20:53       ` Paul E. McKenney
@ 2012-05-08 17:51         ` Paul E. McKenney
  0 siblings, 0 replies; 57+ messages in thread
From: Paul E. McKenney @ 2012-05-08 17:51 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML

On Mon, May 07, 2012 at 01:53:21PM -0700, Paul E. McKenney wrote:
> On Mon, May 07, 2012 at 09:14:04PM +0200, Thomas Gleixner wrote:
> > On Sun, 6 May 2012, Paul E. McKenney wrote:
> > 
> > > On Sat, May 05, 2012 at 03:05:41PM -0000, Thomas Gleixner wrote:
> > > > These flags can be useful for extra allocations outside of the core
> > > > code.
> > > > 
> > > > Add __GFP_NOTRACE to them, so the archs which have kmemcheck do
> > > > not have to provide extra allocators just for that reason.
> > > 
> > > This breaks powerpc builds due to __GFP_NOTRACE not being defined.
> > > I restarted the test after removing the __GFP_NOTRACE as a testing-only
> > > hack, and will let you know how it goes.  Also looking into why this
> > > builds on 32-bit x86 but not on powerpc.
> > 
> > Hrmpf. Seems the idiot I am fatfingered __GFP_NOTRACK to __GFP_NOTRACE
> > and then only tested with the DEBUG stuff disabled......
> 
> That sounds like something I would do...  ;-)
> 
> I will rerun with __GFP_NOTRACK.

Which passes moderate rcutorture testing on Power.

							Thanx, Paul


^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [tip:smp/hotplug] tile: Use common threadinfo allocator
  2012-05-08 12:34   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
@ 2012-05-08 19:02     ` Chris Metcalf
  0 siblings, 0 replies; 57+ messages in thread
From: Chris Metcalf @ 2012-05-08 19:02 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, cmetcalf, tglx; +Cc: linux-tip-commits

On 5/8/2012 8:34 AM, tip-bot for Thomas Gleixner wrote:
> Commit-ID:  d909a81b198a397593495508c4a5755fe95552fb
> Gitweb:     http://git.kernel.org/tip/d909a81b198a397593495508c4a5755fe95552fb
> Author:     Thomas Gleixner <tglx@linutronix.de>
> AuthorDate: Sat, 5 May 2012 15:05:47 +0000
> Committer:  Thomas Gleixner <tglx@linutronix.de>
> CommitDate: Tue, 8 May 2012 13:55:20 +0200
>
> tile: Use common threadinfo allocator
>
> Use the core allocator and deal with the extra cleanup in
> arch_release_thread_info().
>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Chris Metcalf <cmetcalf@tilera.com>
> Link: http://lkml.kernel.org/r/20120505150142.311126440@linutronix.de
> ---
>  arch/tile/include/asm/thread_info.h |    6 ++----
>  arch/tile/kernel/process.c          |   23 ++---------------------
>  2 files changed, 4 insertions(+), 25 deletions(-)

Acked-by: Chris Metcalf <cmetcalf@tilera.com>

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com


^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [patch 07/18] cris: Use common threadinfo allocator
  2012-05-05 15:05 ` [patch 07/18] cris: " Thomas Gleixner
  2012-05-08 12:37   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
@ 2012-05-15 12:49   ` Jesper Nilsson
  1 sibling, 0 replies; 57+ messages in thread
From: Jesper Nilsson @ 2012-05-15 12:49 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML

On Sat, May 05, 2012 at 05:05:43PM +0200, Thomas Gleixner wrote:
> There is no functional difference. __get_free_pages() ends up calling
> alloc_pages_node().
> 
> This also allocates only one page which matches THREAD_SIZE instead of
> an extra page for nothing.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>

/^JN - Jesper Nilsson
-- 
               Jesper Nilsson -- jesper.nilsson@axis.com

^ permalink raw reply	[flat|nested] 57+ messages in thread

end of thread, other threads:[~2012-05-15 12:49 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-05 15:05 [patch 00/18] fork: Move most archs to generic threadinfo/taskstruct allocators Thomas Gleixner
2012-05-05 15:05 ` [patch 01/18] fork: Remove the weak insanity Thomas Gleixner
2012-05-05 15:58   ` Sam Ravnborg
2012-05-07 20:55     ` Thomas Gleixner
2012-05-07 21:03       ` Sam Ravnborg
2012-05-08 12:31   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-05 15:05 ` [patch 03/18] fork: Move thread info gfp flags to header Thomas Gleixner
2012-05-07  4:34   ` Paul E. McKenney
2012-05-07 13:38     ` Paul E. McKenney
2012-05-07 19:14     ` Thomas Gleixner
2012-05-07 20:53       ` Paul E. McKenney
2012-05-08 17:51         ` Paul E. McKenney
2012-05-08 12:32   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-05 15:05 ` [patch 04/18] fork: Provide kmemcache based thread_info allocator Thomas Gleixner
2012-05-08 12:35   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-05 15:05 ` [patch 02/18] fork: Provide weak arch_release_[task_struct|thread_info] functions Thomas Gleixner
2012-05-08 12:33   ` [tip:smp/hotplug] fork: Provide weak arch_release_[ task_struct|thread_info] functions tip-bot for Thomas Gleixner
2012-05-05 15:05 ` [patch 05/18] x86: Use common threadinfo allocator Thomas Gleixner
2012-05-08 12:37   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-05 15:05 ` [patch 06/18] c6x: " Thomas Gleixner
2012-05-07 19:49   ` Mark Salter
2012-05-08 12:36   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-05 15:05 ` [patch 08/18] frv: " Thomas Gleixner
2012-05-08 12:38   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-05 15:05 ` [patch 07/18] cris: " Thomas Gleixner
2012-05-08 12:37   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-15 12:49   ` [patch 07/18] " Jesper Nilsson
2012-05-05 15:05 ` [patch 09/18] hexagon: " Thomas Gleixner
2012-05-08 12:40   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-05 15:05 ` [patch 10/18] m32r: " Thomas Gleixner
2012-05-08 12:39   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-05 15:05 ` [patch 11/18] mips: " Thomas Gleixner
2012-05-08 12:41   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-05 15:05 ` [patch 12/18] mn10300: " Thomas Gleixner
2012-05-08 12:42   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-05 15:05 ` [patch 13/18] powerpc: " Thomas Gleixner
2012-05-08 12:42   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-05 15:05 ` [patch 14/18] score: " Thomas Gleixner
2012-05-08 12:44   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-05 15:05 ` [patch 15/18] sh: " Thomas Gleixner
2012-05-08 12:43   ` [tip:smp/hotplug] sh-use-common-threadinfo-allocator tip-bot for Thomas Gleixner
2012-05-05 15:05 ` [patch 16/18] sparc: Use common threadinfo allocator Thomas Gleixner
2012-05-06 17:03   ` David Miller
2012-05-08 12:45   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-05 15:05 ` [patch 17/18] tile: " Thomas Gleixner
2012-05-05 15:21   ` Chris Metcalf
2012-05-07 19:45     ` Thomas Gleixner
2012-05-07 20:03       ` Chris Metcalf
2012-05-07 20:33         ` Thomas Gleixner
2012-05-07 20:52           ` Chris Metcalf
2012-05-08 12:04             ` Thomas Gleixner
2012-05-08 12:34   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-08 19:02     ` Chris Metcalf
2012-05-05 15:05 ` [patch 18/18] task_allocator: Use config switches instead of magic defines Thomas Gleixner
2012-05-07 20:32   ` Sam Ravnborg
2012-05-07 20:43     ` Thomas Gleixner
2012-05-08 12:46   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).