Skip to content

Commit df9a7b9

Browse files
committed
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
1 parent c03a6a7 commit df9a7b9

2 files changed

Lines changed: 3 additions & 53 deletions

File tree

‎arch/sh/include/asm/thread_info.h‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,13 @@ static inline struct thread_info *current_thread_info(void)
8888
return ti;
8989
}
9090

91-
/* thread information allocation */
92-
#if THREAD_SHIFT >= PAGE_SHIFT
93-
9491
#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT)
9592

96-
#endif
97-
98-
extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node);
99-
extern void free_thread_info(struct thread_info *ti);
10093
extern void arch_task_cache_init(void);
10194
extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
95+
extern void arch_release_task_struct(struct task_struct *tsk);
10296
extern void init_thread_xstate(void);
10397

104-
#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
105-
10698
#endif /* __ASSEMBLY__ */
10799

108100
/*

‎arch/sh/kernel/process.c‎

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -29,52 +29,10 @@ void free_thread_xstate(struct task_struct *tsk)
2929
}
3030
}
3131

32-
#if THREAD_SHIFT < PAGE_SHIFT
33-
static struct kmem_cache *thread_info_cache;
34-
35-
struct 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-
48-
void free_thread_info(struct thread_info *ti)
49-
{
50-
free_thread_xstate(ti->task);
51-
kmem_cache_free(thread_info_cache, ti);
52-
}
53-
54-
void 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
60-
struct 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-
72-
void free_thread_info(struct thread_info *ti)
32+
void arch_release_task_struct(struct task_struct *tsk)
7333
{
74-
free_thread_xstate(ti->task);
75-
free_pages((unsigned long)ti, THREAD_SIZE_ORDER);
34+
free_thread_xstate(tsk);
7635
}
77-
#endif /* THREAD_SHIFT < PAGE_SHIFT */
7836

7937
void arch_task_cache_init(void)
8038
{

0 commit comments

Comments
 (0)