aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2012-05-05 11:05:46 -0400
committerThomas Gleixner <tglx@linutronix.de>2012-05-08 08:08:45 -0400
commitdf9a7b9b5d1a5ef8cd3474d0cea2c6428542e288 (patch)
tree4754c209b5df6eec595cb18ef9f0bb2e59a511d9
parentc03a6a7ba6f456663e4b254cdde460b24c0852e1 (diff)
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
-rw-r--r--arch/sh/include/asm/thread_info.h10
-rw-r--r--arch/sh/kernel/process.c46
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 09963d4018cb..b6902061d4dc 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)
88 return ti; 88 return ti;
89} 89}
90 90
91/* thread information allocation */
92#if THREAD_SHIFT >= PAGE_SHIFT
93
94#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) 91#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT)
95 92
96#endif
97
98extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node);
99extern void free_thread_info(struct thread_info *ti);
100extern void arch_task_cache_init(void); 93extern void arch_task_cache_init(void);
101extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); 94extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
95extern void arch_release_task_struct(struct task_struct *tsk);
102extern void init_thread_xstate(void); 96extern void init_thread_xstate(void);
103 97
104#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
105
106#endif /* __ASSEMBLY__ */ 98#endif /* __ASSEMBLY__ */
107 99
108/* 100/*
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index 325f98b1736d..f2621abdf01d 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)
29 } 29 }
30} 30}
31 31
32#if THREAD_SHIFT < PAGE_SHIFT 32void arch_release_task_struct(struct task_struct *tsk)
33static struct kmem_cache *thread_info_cache;
34
35struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node)
36{
37 struct thread_info *ti;
38#ifdef CONFIG_DEBUG_STACK_USAGE
39 gfp_t mask = GFP_KERNEL | __GFP_ZERO;
40#else
41 gfp_t mask = GFP_KERNEL;
42#endif
43
44 ti = kmem_cache_alloc_node(thread_info_cache, mask, node);
45 return ti;
46}
47
48void free_thread_info(struct thread_info *ti)
49{
50 free_thread_xstate(ti->task);
51 kmem_cache_free(thread_info_cache, ti);
52}
53
54void thread_info_cache_init(void)
55{
56 thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE,
57 THREAD_SIZE, SLAB_PANIC, NULL);
58}
59#else
60struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node)
61{
62#ifdef CONFIG_DEBUG_STACK_USAGE
63 gfp_t mask = GFP_KERNEL | __GFP_ZERO;
64#else
65 gfp_t mask = GFP_KERNEL;
66#endif
67 struct page *page = alloc_pages_node(node, mask, THREAD_SIZE_ORDER);
68
69 return page ? page_address(page) : NULL;
70}
71
72void free_thread_info(struct thread_info *ti)
73{ 33{
74 free_thread_xstate(ti->task); 34 free_thread_xstate(tsk);
75 free_pages((unsigned long)ti, THREAD_SIZE_ORDER);
76} 35}
77#endif /* THREAD_SHIFT < PAGE_SHIFT */
78 36
79void arch_task_cache_init(void) 37void arch_task_cache_init(void)
80{ 38{