aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-01-12 05:01:11 -0500
committerPaul Mundt <lethal@linux-sh.org>2010-01-12 05:01:11 -0500
commitcbf6b1ba7ae12b3f7cb6b0d060b88d44649f9eda (patch)
tree267582b42611b11c6a01681855d190bacf488b01 /arch/sh
parent70e068eef97d05c97c3512f82352f39fdadfa8cb (diff)
sh: Always provide thread_info allocators.
Presently the thread_info allocators are special cased, depending on THREAD_SHIFT < PAGE_SHIFT. This provides a sensible definition for them regardless of configuration, in preparation for extended CPU state. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/include/asm/thread_info.h6
-rw-r--r--arch/sh/kernel/Makefile4
-rw-r--r--arch/sh/kernel/process.c47
-rw-r--r--arch/sh/mm/init.c29
4 files changed, 51 insertions, 35 deletions
diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
index 1f3d927e2265..2c5b48edeab9 100644
--- a/arch/sh/include/asm/thread_info.h
+++ b/arch/sh/include/asm/thread_info.h
@@ -93,14 +93,12 @@ static inline struct thread_info *current_thread_info(void)
93 93
94#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) 94#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT)
95 95
96#else /* THREAD_SHIFT < PAGE_SHIFT */ 96#endif
97
98#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
99 97
100extern struct thread_info *alloc_thread_info(struct task_struct *tsk); 98extern struct thread_info *alloc_thread_info(struct task_struct *tsk);
101extern void free_thread_info(struct thread_info *ti); 99extern void free_thread_info(struct thread_info *ti);
102 100
103#endif /* THREAD_SHIFT < PAGE_SHIFT */ 101#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
104 102
105#endif /* __ASSEMBLY__ */ 103#endif /* __ASSEMBLY__ */
106 104
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index 5bec10c8bd74..379053c008f7 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -13,8 +13,8 @@ CFLAGS_REMOVE_return_address.o = -pg
13 13
14obj-y := debugtraps.o dma-nommu.o dumpstack.o \ 14obj-y := debugtraps.o dma-nommu.o dumpstack.o \
15 idle.o io.o io_generic.o irq.o \ 15 idle.o io.o io_generic.o irq.o \
16 irq_$(BITS).o machvec.o nmi_debug.o process_$(BITS).o \ 16 irq_$(BITS).o machvec.o nmi_debug.o process.o \
17 ptrace_$(BITS).o return_address.o \ 17 process_$(BITS).o ptrace_$(BITS).o return_address.o \
18 setup.o signal_$(BITS).o sys_sh.o sys_sh$(BITS).o \ 18 setup.o signal_$(BITS).o sys_sh.o sys_sh$(BITS).o \
19 syscalls_$(BITS).o time.o topology.o traps.o \ 19 syscalls_$(BITS).o time.o topology.o traps.o \
20 traps_$(BITS).o unwinder.o 20 traps_$(BITS).o unwinder.o
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
new file mode 100644
index 000000000000..b2bda83baeef
--- /dev/null
+++ b/arch/sh/kernel/process.c
@@ -0,0 +1,47 @@
1#include <linux/mm.h>
2#include <linux/kernel.h>
3#include <linux/sched.h>
4
5#if THREAD_SHIFT < PAGE_SHIFT
6static struct kmem_cache *thread_info_cache;
7
8struct thread_info *alloc_thread_info(struct task_struct *tsk)
9{
10 struct thread_info *ti;
11
12 ti = kmem_cache_alloc(thread_info_cache, GFP_KERNEL);
13 if (unlikely(ti == NULL))
14 return NULL;
15#ifdef CONFIG_DEBUG_STACK_USAGE
16 memset(ti, 0, THREAD_SIZE);
17#endif
18 return ti;
19}
20
21void free_thread_info(struct thread_info *ti)
22{
23 kmem_cache_free(thread_info_cache, ti);
24}
25
26void thread_info_cache_init(void)
27{
28 thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE,
29 THREAD_SIZE, 0, NULL);
30 BUG_ON(thread_info_cache == NULL);
31}
32#else
33struct thread_info *alloc_thread_info(struct task_struct *tsk)
34{
35#ifdef CONFIG_DEBUG_STACK_USAGE
36 gfp_t mask = GFP_KERNEL | __GFP_ZERO;
37#else
38 gfp_t mask = GFP_KERNEL;
39#endif
40 return (struct thread_info *)__get_free_pages(mask, THREAD_SIZE_ORDER);
41}
42
43void free_thread_info(struct thread_info *ti)
44{
45 free_pages((unsigned long)ti, THREAD_SIZE_ORDER);
46}
47#endif /* THREAD_SHIFT < PAGE_SHIFT */
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 761910d142f8..d5fb014279ad 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -283,35 +283,6 @@ void free_initrd_mem(unsigned long start, unsigned long end)
283} 283}
284#endif 284#endif
285 285
286#if THREAD_SHIFT < PAGE_SHIFT
287static struct kmem_cache *thread_info_cache;
288
289struct thread_info *alloc_thread_info(struct task_struct *tsk)
290{
291 struct thread_info *ti;
292
293 ti = kmem_cache_alloc(thread_info_cache, GFP_KERNEL);
294 if (unlikely(ti == NULL))
295 return NULL;
296#ifdef CONFIG_DEBUG_STACK_USAGE
297 memset(ti, 0, THREAD_SIZE);
298#endif
299 return ti;
300}
301
302void free_thread_info(struct thread_info *ti)
303{
304 kmem_cache_free(thread_info_cache, ti);
305}
306
307void thread_info_cache_init(void)
308{
309 thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE,
310 THREAD_SIZE, 0, NULL);
311 BUG_ON(thread_info_cache == NULL);
312}
313#endif /* THREAD_SHIFT < PAGE_SHIFT */
314
315#ifdef CONFIG_MEMORY_HOTPLUG 286#ifdef CONFIG_MEMORY_HOTPLUG
316int arch_add_memory(int nid, u64 start, u64 size) 287int arch_add_memory(int nid, u64 start, u64 size)
317{ 288{