]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
sh: Always provide thread_info allocators.
authorPaul Mundt <lethal@linux-sh.org>
Tue, 12 Jan 2010 10:01:11 +0000 (19:01 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Tue, 12 Jan 2010 10:01:11 +0000 (19:01 +0900)
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>
arch/sh/include/asm/thread_info.h
arch/sh/kernel/Makefile
arch/sh/kernel/process.c [new file with mode: 0644]
arch/sh/mm/init.c

index 1f3d927e22659c1a99564958a584db4aafe042c2..2c5b48edeab9cbd1f6ae9cee09fd34ec49193136 100644 (file)
@@ -93,14 +93,12 @@ static inline struct thread_info *current_thread_info(void)
 
 #define THREAD_SIZE_ORDER      (THREAD_SHIFT - PAGE_SHIFT)
 
-#else /* THREAD_SHIFT < PAGE_SHIFT */
-
-#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
+#endif
 
 extern struct thread_info *alloc_thread_info(struct task_struct *tsk);
 extern void free_thread_info(struct thread_info *ti);
 
-#endif /* THREAD_SHIFT < PAGE_SHIFT */
+#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
 
 #endif /* __ASSEMBLY__ */
 
index 5bec10c8bd7462b91384cf158b8956ba1e2a33a9..379053c008f7a820120aacdfe4ffe53eb11ed91b 100644 (file)
@@ -13,8 +13,8 @@ CFLAGS_REMOVE_return_address.o = -pg
 
 obj-y  := debugtraps.o dma-nommu.o dumpstack.o                         \
           idle.o io.o io_generic.o irq.o                               \
-          irq_$(BITS).o machvec.o nmi_debug.o process_$(BITS).o        \
-          ptrace_$(BITS).o return_address.o                            \
+          irq_$(BITS).o machvec.o nmi_debug.o process.o                \
+          process_$(BITS).o ptrace_$(BITS).o return_address.o          \
           setup.o signal_$(BITS).o sys_sh.o sys_sh$(BITS).o            \
           syscalls_$(BITS).o time.o topology.o traps.o                 \
           traps_$(BITS).o unwinder.o
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
new file mode 100644 (file)
index 0000000..b2bda83
--- /dev/null
@@ -0,0 +1,47 @@
+#include <linux/mm.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+
+#if THREAD_SHIFT < PAGE_SHIFT
+static struct kmem_cache *thread_info_cache;
+
+struct thread_info *alloc_thread_info(struct task_struct *tsk)
+{
+       struct thread_info *ti;
+
+       ti = kmem_cache_alloc(thread_info_cache, GFP_KERNEL);
+       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);
+}
+#else
+struct thread_info *alloc_thread_info(struct task_struct *tsk)
+{
+#ifdef CONFIG_DEBUG_STACK_USAGE
+       gfp_t mask = GFP_KERNEL | __GFP_ZERO;
+#else
+       gfp_t mask = GFP_KERNEL;
+#endif
+       return (struct thread_info *)__get_free_pages(mask, THREAD_SIZE_ORDER);
+}
+
+void free_thread_info(struct thread_info *ti)
+{
+       free_pages((unsigned long)ti, THREAD_SIZE_ORDER);
+}
+#endif /* THREAD_SHIFT < PAGE_SHIFT */
index 761910d142f8e11e5d2ae3f51de8c40dfa8aeda7..d5fb014279ad21758cd0e96f45c7585077c4e661 100644 (file)
@@ -283,35 +283,6 @@ void free_initrd_mem(unsigned long start, unsigned long end)
 }
 #endif
 
-#if THREAD_SHIFT < PAGE_SHIFT
-static struct kmem_cache *thread_info_cache;
-
-struct thread_info *alloc_thread_info(struct task_struct *tsk)
-{
-       struct thread_info *ti;
-
-       ti = kmem_cache_alloc(thread_info_cache, GFP_KERNEL);
-       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 */
-
 #ifdef CONFIG_MEMORY_HOTPLUG
 int arch_add_memory(int nid, u64 start, u64 size)
 {