Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b69c49b7 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by Linus Torvalds
Browse files

clean up duplicated alloc/free_thread_info



We duplicate alloc/free_thread_info defines on many platforms (the
majority uses __get_free_pages/free_pages).  This patch defines common
defines and removes these duplicated defines.
__HAVE_ARCH_THREAD_INFO_ALLOCATOR is introduced for platforms that do
something different.

Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 62ec30d4
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -50,10 +50,8 @@ register struct thread_info *__current_thread_info __asm__("$8");
#define current_thread_info()  __current_thread_info
#define current_thread_info()  __current_thread_info


/* Thread information allocation.  */
/* Thread information allocation.  */
#define THREAD_SIZE_ORDER 1
#define THREAD_SIZE (2*PAGE_SIZE)
#define THREAD_SIZE (2*PAGE_SIZE)
#define alloc_thread_info(tsk) \
  ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)


#endif /* __ASSEMBLY__ */
#endif /* __ASSEMBLY__ */


+0 −13
Original line number Original line Diff line number Diff line
@@ -97,19 +97,6 @@ static inline struct thread_info *current_thread_info(void)
	return (struct thread_info *)(sp & ~(THREAD_SIZE - 1));
	return (struct thread_info *)(sp & ~(THREAD_SIZE - 1));
}
}


/* thread information allocation */
#ifdef CONFIG_DEBUG_STACK_USAGE
#define alloc_thread_info(tsk) \
	((struct thread_info *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, \
		THREAD_SIZE_ORDER))
#else
#define alloc_thread_info(tsk) \
	((struct thread_info *)__get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER))
#endif

#define free_thread_info(info) \
	free_pages((unsigned long)info, THREAD_SIZE_ORDER);

#define thread_saved_pc(tsk)	\
#define thread_saved_pc(tsk)	\
	((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc)))
	((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc)))
#define thread_saved_fp(tsk)	\
#define thread_saved_fp(tsk)	\
+0 −4
Original line number Original line Diff line number Diff line
@@ -61,10 +61,6 @@ static inline struct thread_info *current_thread_info(void)
	return (struct thread_info *)addr;
	return (struct thread_info *)addr;
}
}


/* thread information allocation */
#define alloc_thread_info(ti) \
	((struct thread_info *) __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER))
#define free_thread_info(ti) free_pages((unsigned long)(ti), 1)
#define get_thread_info(ti) get_task_struct((ti)->task)
#define get_thread_info(ti) get_task_struct((ti)->task)
#define put_thread_info(ti) put_task_struct((ti)->task)
#define put_thread_info(ti) put_task_struct((ti)->task)


+1 −4
Original line number Original line Diff line number Diff line
@@ -42,6 +42,7 @@
/*
/*
 * Size of kernel stack for each process. This must be a power of 2...
 * Size of kernel stack for each process. This must be a power of 2...
 */
 */
#define THREAD_SIZE_ORDER	1
#define THREAD_SIZE		8192	/* 2 pages */
#define THREAD_SIZE		8192	/* 2 pages */


#ifndef __ASSEMBLY__
#ifndef __ASSEMBLY__
@@ -94,10 +95,6 @@ static inline struct thread_info *current_thread_info(void)
	return (struct thread_info *)((long)ti & ~((long)THREAD_SIZE-1));
	return (struct thread_info *)((long)ti & ~((long)THREAD_SIZE-1));
}
}


/* thread information allocation */
#define alloc_thread_info(tsk) ((struct thread_info *) \
				__get_free_pages(GFP_KERNEL, 1))
#define free_thread_info(ti)	free_pages((unsigned long) (ti), 1)
#endif				/* __ASSEMBLY__ */
#endif				/* __ASSEMBLY__ */


/*
/*
+2 −0
Original line number Original line Diff line number Diff line
@@ -11,6 +11,8 @@


#ifdef __KERNEL__
#ifdef __KERNEL__


#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR

#ifndef __ASSEMBLY__
#ifndef __ASSEMBLY__
#include <asm/types.h>
#include <asm/types.h>
#include <asm/processor.h>
#include <asm/processor.h>
Loading