From cce4517f33384c3794c759e206cc8e1bb6df146b Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 3 May 2012 09:02:47 +0000 Subject: frv: Use correct size for task_struct allocation alloc_task_struct_node() allocates THREAD_SIZE and maintains some weird refcount in the allocated memory. This never blew up as task_struct size on 32bit machines was always less than THREAD_SIZE Allocate just sizeof(struct task_struct) and get rid of the magic refcounting. Signed-off-by: Thomas Gleixner Acked-by: David Howells Link: http://lkml.kernel.org/r/20120503085033.898475542@linutronix.de --- arch/frv/kernel/process.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'arch/frv') diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c index d4de48bd5efe..1ac84b2e5a0f 100644 --- a/arch/frv/kernel/process.c +++ b/arch/frv/kernel/process.c @@ -45,17 +45,12 @@ EXPORT_SYMBOL(pm_power_off); struct task_struct *alloc_task_struct_node(int node) { - struct task_struct *p = kmalloc_node(THREAD_SIZE, GFP_KERNEL, node); - - if (p) - atomic_set((atomic_t *)(p+1), 1); - return p; + return kmalloc_node(sizeof(task_struct), GFP_KERNEL, node); } void free_task_struct(struct task_struct *p) { - if (atomic_dec_and_test((atomic_t *)(p+1))) - kfree(p); + kfree(p); } static void core_sleep_idle(void) -- cgit v1.2.3 From c6ae063aaf3786b9db7f19a90bf4ed8aaebb7f90 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 3 May 2012 09:02:47 +0000 Subject: frv: Use core allocator for task_struct There is no point having a copy of the core allocator. Signed-off-by: Thomas Gleixner Acked-by: David Howells Link: http://lkml.kernel.org/r/20120503085033.967140188@linutronix.de --- arch/frv/include/asm/thread_info.h | 2 -- arch/frv/kernel/process.c | 10 ---------- 2 files changed, 12 deletions(-) (limited to 'arch/frv') diff --git a/arch/frv/include/asm/thread_info.h b/arch/frv/include/asm/thread_info.h index 92d83ea99ae5..aaea388a57d9 100644 --- a/arch/frv/include/asm/thread_info.h +++ b/arch/frv/include/asm/thread_info.h @@ -21,8 +21,6 @@ #define THREAD_SIZE 8192 -#define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR - /* * low level task data that entry.S needs immediate access to * - this struct should fit entirely inside of one cache line diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c index 1ac84b2e5a0f..ed09e9e2c653 100644 --- a/arch/frv/kernel/process.c +++ b/arch/frv/kernel/process.c @@ -43,16 +43,6 @@ asmlinkage void ret_from_fork(void); void (*pm_power_off)(void); EXPORT_SYMBOL(pm_power_off); -struct task_struct *alloc_task_struct_node(int node) -{ - return kmalloc_node(sizeof(task_struct), GFP_KERNEL, node); -} - -void free_task_struct(struct task_struct *p) -{ - kfree(p); -} - static void core_sleep_idle(void) { #ifdef LED_DEBUG_SLEEP -- cgit v1.2.3 From cb0fcba283a98f8438ca69b76b0dcb92cce5a951 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 3 May 2012 09:02:53 +0000 Subject: frv: Use generic init_task Same code. Use the generic version. The special Makefile treatment is pointless anyway as init_task.o contains only data which is handled by the linker script. So no point on being treated like head text. Signed-off-by: Thomas Gleixner Acked-by: David Howells Link: http://lkml.kernel.org/r/20120503085034.546687215@linutronix.de --- arch/frv/Kconfig | 1 + arch/frv/Makefile | 2 +- arch/frv/kernel/Makefile | 2 +- arch/frv/kernel/init_task.c | 32 -------------------------------- 4 files changed, 3 insertions(+), 34 deletions(-) delete mode 100644 arch/frv/kernel/init_task.c (limited to 'arch/frv') diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index a685910d2d5c..ed6dbd290c42 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig @@ -9,6 +9,7 @@ config FRV select GENERIC_IRQ_SHOW select ARCH_HAVE_NMI_SAFE_CMPXCHG select GENERIC_CPU_DEVICES + select HAVE_GENERIC_INIT_TASK config ZONE_DMA bool diff --git a/arch/frv/Makefile b/arch/frv/Makefile index 7ff84575b186..4d1b1e9baef1 100644 --- a/arch/frv/Makefile +++ b/arch/frv/Makefile @@ -81,7 +81,7 @@ ifdef CONFIG_DEBUG_INFO KBUILD_AFLAGS += -Wa,--gdwarf2 endif -head-y := arch/frv/kernel/head.o arch/frv/kernel/init_task.o +head-y := arch/frv/kernel/head.o core-y += arch/frv/kernel/ arch/frv/mm/ libs-y += arch/frv/lib/ diff --git a/arch/frv/kernel/Makefile b/arch/frv/kernel/Makefile index c36f70b6699a..ad4087b69968 100644 --- a/arch/frv/kernel/Makefile +++ b/arch/frv/kernel/Makefile @@ -5,7 +5,7 @@ heads-y := head-uc-fr401.o head-uc-fr451.o head-uc-fr555.o heads-$(CONFIG_MMU) := head-mmu-fr451.o -extra-y:= head.o init_task.o vmlinux.lds +extra-y:= head.o vmlinux.lds obj-y := $(heads-y) entry.o entry-table.o break.o switch_to.o kernel_thread.o \ kernel_execve.o process.o traps.o ptrace.o signal.o dma.o \ diff --git a/arch/frv/kernel/init_task.c b/arch/frv/kernel/init_task.c deleted file mode 100644 index 3c3e0b336a9d..000000000000 --- a/arch/frv/kernel/init_task.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include -#include - - -static struct signal_struct init_signals = INIT_SIGNALS(init_signals); -static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); -/* - * Initial thread structure. - * - * We need to make sure that this is THREAD_SIZE aligned due to the - * way process stacks are handled. This is done by having a special - * "init_task" linker map entry.. - */ -union thread_union init_thread_union __init_task_data = - { INIT_THREAD_INFO(init_task) }; - -/* - * Initial task structure. - * - * All other task structs will be allocated on slabs in fork.c - */ -struct task_struct init_task = INIT_TASK(init_task); - -EXPORT_SYMBOL(init_task); -- cgit v1.2.3 From a6359d1eec43d1fd6ffbac958149844873e0084f Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 3 May 2012 09:03:02 +0000 Subject: init_task: Replace CONFIG_HAVE_GENERIC_INIT_TASK Now that all archs except ia64 are converted, replace the config and let the ia64 select CONFIG_ARCH_INIT_TASK Signed-off-by: Thomas Gleixner Link: http://lkml.kernel.org/r/20120503085035.867948914@linutronix.de --- arch/frv/Kconfig | 1 - 1 file changed, 1 deletion(-) (limited to 'arch/frv') diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index ed6dbd290c42..a685910d2d5c 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig @@ -9,7 +9,6 @@ config FRV select GENERIC_IRQ_SHOW select ARCH_HAVE_NMI_SAFE_CMPXCHG select GENERIC_CPU_DEVICES - select HAVE_GENERIC_INIT_TASK config ZONE_DMA bool -- cgit v1.2.3 From c64872cd0dd5892f4d6f3605ffca36d13e63443d Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sat, 5 May 2012 15:05:43 +0000 Subject: 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 Cc: David Howells Link: http://lkml.kernel.org/r/20120505150141.751600045@linutronix.de --- arch/frv/include/asm/thread_info.h | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'arch/frv') diff --git a/arch/frv/include/asm/thread_info.h b/arch/frv/include/asm/thread_info.h index aaea388a57d9..54ab13a0de41 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__ */ /* -- cgit v1.2.3