fork: move the real prepare_to_copy() users to arch_dup_task_struct()
Historical prepare_to_copy() is mostly a no-op, duplicated for majority of the architectures and the rest following the x86 model of flushing the extended register state like fpu there. Remove it and use the arch_dup_task_struct() instead. Suggested-by: Oleg Nesterov <oleg@redhat.com> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Link: http://lkml.kernel.org/r/1336692811-30576-1-git-send-email-suresh.b.siddha@intel.com Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: David Howells <dhowells@redhat.com> Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Chris Zankel <chris@zankel.net> Cc: Richard Henderson <rth@twiddle.net> Cc: Russell King <linux@arm.linux.org.uk> Cc: Haavard Skinnemoen <hskinnemoen@gmail.com> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Mark Salter <msalter@redhat.com> Cc: Aurelien Jacquiot <a-jacquiot@ti.com> Cc: Mikael Starvik <starvik@axis.com> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Cc: Richard Kuo <rkuo@codeaurora.org> Cc: Tony Luck <tony.luck@intel.com> Cc: Michal Simek <monstr@monstr.eu> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Jonas Bonn <jonas@southpole.se> Cc: James E.J. Bottomley <jejb@parisc-linux.org> Cc: Helge Deller <deller@gmx.de> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Chen Liqin <liqin.chen@sunplusct.com> Cc: Lennox Wu <lennox.wu@gmail.com> Cc: David S. Miller <davem@davemloft.net> Cc: Chris Metcalf <cmetcalf@tilera.com> Cc: Jeff Dike <jdike@addtoit.com> Cc: Richard Weinberger <richard@nod.at> Cc: Guan Xuetao <gxt@mprc.pku.edu.cn> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
		
					parent
					
						
							
								36be50515f
							
						
					
				
			
			
				commit
				
					
						55ccf3fe3f
					
				
			
		
					 39 changed files with 36 additions and 140 deletions
				
			
		| 
						 | 
				
			
			@ -49,9 +49,6 @@ extern void start_thread(struct pt_regs *, unsigned long, unsigned long);
 | 
			
		|||
/* Free all resources held by a thread. */
 | 
			
		||||
extern void release_thread(struct task_struct *);
 | 
			
		||||
 | 
			
		||||
/* Prepare to copy thread state - unlazy all lazy status */
 | 
			
		||||
#define prepare_to_copy(tsk)	do { } while (0)
 | 
			
		||||
 | 
			
		||||
/* Create a kernel thread without removing it from tasklists.  */
 | 
			
		||||
extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -77,9 +77,6 @@ struct task_struct;
 | 
			
		|||
/* Free all resources held by a thread. */
 | 
			
		||||
extern void release_thread(struct task_struct *);
 | 
			
		||||
 | 
			
		||||
/* Prepare to copy thread state - unlazy all lazy status */
 | 
			
		||||
#define prepare_to_copy(tsk)	do { } while (0)
 | 
			
		||||
 | 
			
		||||
unsigned long get_wchan(struct task_struct *p);
 | 
			
		||||
 | 
			
		||||
#if __LINUX_ARM_ARCH__ == 6 || defined(CONFIG_ARM_ERRATA_754327)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -145,9 +145,6 @@ extern void release_thread(struct task_struct *);
 | 
			
		|||
/* Create a kernel thread without removing it from tasklists */
 | 
			
		||||
extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
 | 
			
		||||
 | 
			
		||||
/* Prepare to copy thread state - unlazy all lazy status */
 | 
			
		||||
#define prepare_to_copy(tsk) do { } while(0)
 | 
			
		||||
 | 
			
		||||
/* Return saved PC of a blocked thread */
 | 
			
		||||
#define thread_saved_pc(tsk)    ((tsk)->thread.cpu_context.pc)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -75,8 +75,6 @@ static inline void release_thread(struct task_struct *dead_task)
 | 
			
		|||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define prepare_to_copy(tsk)	do { } while (0)
 | 
			
		||||
 | 
			
		||||
extern int kernel_thread(int (*fn) (void *), void *arg, unsigned long flags);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -92,9 +92,6 @@ static inline void release_thread(struct task_struct *dead_task)
 | 
			
		|||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Prepare to copy thread state - unlazy all lazy status */
 | 
			
		||||
#define prepare_to_copy(tsk)	do { } while (0)
 | 
			
		||||
 | 
			
		||||
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 | 
			
		||||
 | 
			
		||||
#define copy_segments(tsk, mm)		do { } while (0)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,10 +50,6 @@ struct task_struct;
 | 
			
		|||
#define task_pt_regs(task) user_regs(task_thread_info(task))
 | 
			
		||||
#define current_regs() task_pt_regs(current)
 | 
			
		||||
 | 
			
		||||
static inline void prepare_to_copy(struct task_struct *tsk)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 | 
			
		||||
 | 
			
		||||
unsigned long get_wchan(struct task_struct *p);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -103,8 +103,6 @@ do {							\
 | 
			
		|||
	__frame->sp	= (_usp);			\
 | 
			
		||||
} while(0)
 | 
			
		||||
 | 
			
		||||
extern void prepare_to_copy(struct task_struct *tsk);
 | 
			
		||||
 | 
			
		||||
/* Free all resources held by a thread. */
 | 
			
		||||
static inline void release_thread(struct task_struct *dead_task)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -180,17 +180,6 @@ asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp,
 | 
			
		|||
	return do_fork(clone_flags, newsp, __frame, 0, parent_tidptr, child_tidptr);
 | 
			
		||||
} /* end sys_clone() */
 | 
			
		||||
 | 
			
		||||
/*****************************************************************************/
 | 
			
		||||
/*
 | 
			
		||||
 * This gets called before we allocate a new thread and copy
 | 
			
		||||
 * the current task into it.
 | 
			
		||||
 */
 | 
			
		||||
void prepare_to_copy(struct task_struct *tsk)
 | 
			
		||||
{
 | 
			
		||||
	//unlazy_fpu(tsk);
 | 
			
		||||
} /* end prepare_to_copy() */
 | 
			
		||||
 | 
			
		||||
/*****************************************************************************/
 | 
			
		||||
/*
 | 
			
		||||
 * set up the kernel stack and exception frames for a new process
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -109,8 +109,6 @@ static inline void release_thread(struct task_struct *dead_task)
 | 
			
		|||
 | 
			
		||||
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 | 
			
		||||
 | 
			
		||||
#define prepare_to_copy(tsk)	do { } while (0)
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Free current thread data structures etc..
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,13 +58,6 @@ struct thread_struct {
 | 
			
		|||
 | 
			
		||||
#define cpu_relax() __vmyield()
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * "Unlazying all lazy status" occurs here.
 | 
			
		||||
 */
 | 
			
		||||
static inline void prepare_to_copy(struct task_struct *tsk)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Decides where the kernel will search for a free chunk of vm space during
 | 
			
		||||
 * mmaps.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -343,9 +343,6 @@ struct task_struct;
 | 
			
		|||
 */
 | 
			
		||||
#define release_thread(dead_task)
 | 
			
		||||
 | 
			
		||||
/* Prepare to copy thread state - unlazy all lazy status */
 | 
			
		||||
#define prepare_to_copy(tsk)	do { } while (0)
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This is the mechanism for creating a new kernel thread.
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -118,8 +118,6 @@ struct mm_struct;
 | 
			
		|||
/* Free all resources held by a thread. */
 | 
			
		||||
extern void release_thread(struct task_struct *);
 | 
			
		||||
 | 
			
		||||
#define prepare_to_copy(tsk)	do { } while (0)
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * create a kernel thread without removing it from tasklists
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -153,9 +153,6 @@ static inline void release_thread(struct task_struct *dead_task)
 | 
			
		|||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Prepare to copy thread state - unlazy all lazy status */
 | 
			
		||||
#define prepare_to_copy(tsk)	do { } while (0)
 | 
			
		||||
 | 
			
		||||
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,6 @@ extern const struct seq_operations cpuinfo_op;
 | 
			
		|||
 | 
			
		||||
# define cpu_relax()		barrier()
 | 
			
		||||
# define cpu_sleep()		do {} while (0)
 | 
			
		||||
# define prepare_to_copy(tsk)	do {} while (0)
 | 
			
		||||
 | 
			
		||||
#define task_pt_regs(tsk) \
 | 
			
		||||
		(((struct pt_regs *)(THREAD_SIZE + task_stack_page(tsk))) - 1)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -310,9 +310,6 @@ struct task_struct;
 | 
			
		|||
/* Free all resources held by a thread. */
 | 
			
		||||
#define release_thread(thread) do { } while(0)
 | 
			
		||||
 | 
			
		||||
/* Prepare to copy thread state - unlazy all lazy status */
 | 
			
		||||
#define prepare_to_copy(tsk)	do { } while (0)
 | 
			
		||||
 | 
			
		||||
extern long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 | 
			
		||||
 | 
			
		||||
extern unsigned long thread_saved_pc(struct task_struct *tsk);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -139,9 +139,6 @@ static inline void start_thread(struct pt_regs *regs,
 | 
			
		|||
/* Free all resources held by a thread. */
 | 
			
		||||
extern void release_thread(struct task_struct *);
 | 
			
		||||
 | 
			
		||||
/* Prepare to copy thread state - unlazy all lazy status */
 | 
			
		||||
extern void prepare_to_copy(struct task_struct *tsk);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * create a kernel thread without removing it from tasklists
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -208,12 +208,14 @@ void copy_segments(struct task_struct *p, struct mm_struct *new_mm)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * this gets called before we allocate a new thread and copy the current task
 | 
			
		||||
 * into it so that we can store lazy state into memory
 | 
			
		||||
 * this gets called so that we can store lazy state into memory and copy the
 | 
			
		||||
 * current task into the new thread.
 | 
			
		||||
 */
 | 
			
		||||
void prepare_to_copy(struct task_struct *tsk)
 | 
			
		||||
int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 | 
			
		||||
{
 | 
			
		||||
	unlazy_fpu(tsk);
 | 
			
		||||
	unlazy_fpu(src);
 | 
			
		||||
	*dst = *src;
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -72,10 +72,6 @@ struct thread_struct {
 | 
			
		|||
#define task_pt_regs(task) user_regs(task_thread_info(task))
 | 
			
		||||
#define current_regs() user_regs(current_thread_info())
 | 
			
		||||
 | 
			
		||||
extern inline void prepare_to_copy(struct task_struct *tsk)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define INIT_SP         (sizeof(init_stack) + (unsigned long) &init_stack)
 | 
			
		||||
 | 
			
		||||
#define INIT_THREAD  { }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -328,9 +328,6 @@ struct mm_struct;
 | 
			
		|||
extern void release_thread(struct task_struct *);
 | 
			
		||||
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 | 
			
		||||
 | 
			
		||||
/* Prepare to copy thread state - unlazy all lazy status */
 | 
			
		||||
#define prepare_to_copy(tsk)	do { } while (0)
 | 
			
		||||
 | 
			
		||||
extern void map_hpux_gateway_page(struct task_struct *tsk, struct mm_struct *mm);
 | 
			
		||||
 | 
			
		||||
extern unsigned long get_wchan(struct task_struct *p);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -74,9 +74,6 @@ struct task_struct;
 | 
			
		|||
void start_thread(struct pt_regs *regs, unsigned long fdptr, unsigned long sp);
 | 
			
		||||
void release_thread(struct task_struct *);
 | 
			
		||||
 | 
			
		||||
/* Prepare to copy thread state - unlazy all lazy status */
 | 
			
		||||
extern void prepare_to_copy(struct task_struct *tsk);
 | 
			
		||||
 | 
			
		||||
/* Create a new kernel thread. */
 | 
			
		||||
extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -711,18 +711,21 @@ release_thread(struct task_struct *t)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This gets called before we allocate a new thread and copy
 | 
			
		||||
 * the current task into it.
 | 
			
		||||
 * this gets called so that we can store coprocessor state into memory and
 | 
			
		||||
 * copy the current task into the new thread.
 | 
			
		||||
 */
 | 
			
		||||
void prepare_to_copy(struct task_struct *tsk)
 | 
			
		||||
int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 | 
			
		||||
{
 | 
			
		||||
	flush_fp_to_thread(current);
 | 
			
		||||
	flush_altivec_to_thread(current);
 | 
			
		||||
	flush_vsx_to_thread(current);
 | 
			
		||||
	flush_spe_to_thread(current);
 | 
			
		||||
	flush_fp_to_thread(src);
 | 
			
		||||
	flush_altivec_to_thread(src);
 | 
			
		||||
	flush_vsx_to_thread(src);
 | 
			
		||||
	flush_spe_to_thread(src);
 | 
			
		||||
#ifdef CONFIG_HAVE_HW_BREAKPOINT
 | 
			
		||||
	flush_ptrace_hw_breakpoint(tsk);
 | 
			
		||||
	flush_ptrace_hw_breakpoint(src);
 | 
			
		||||
#endif /* CONFIG_HAVE_HW_BREAKPOINT */
 | 
			
		||||
 | 
			
		||||
	*dst = *src;
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -141,9 +141,6 @@ struct seq_file;
 | 
			
		|||
extern void release_thread(struct task_struct *);
 | 
			
		||||
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 | 
			
		||||
 | 
			
		||||
/* Prepare to copy thread state - unlazy all lazy status */
 | 
			
		||||
#define prepare_to_copy(tsk)	do { } while (0)
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Return saved PC of a blocked thread.
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,7 +26,6 @@ extern unsigned long get_wchan(struct task_struct *p);
 | 
			
		|||
 | 
			
		||||
#define cpu_relax()		barrier()
 | 
			
		||||
#define release_thread(thread)	do {} while (0)
 | 
			
		||||
#define prepare_to_copy(tsk)	do {} while (0)
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * User space process size: 2GB. This is hardcoded into a few places,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -126,9 +126,6 @@ extern void start_thread(struct pt_regs *regs, unsigned long new_pc, unsigned lo
 | 
			
		|||
/* Free all resources held by a thread. */
 | 
			
		||||
extern void release_thread(struct task_struct *);
 | 
			
		||||
 | 
			
		||||
/* Prepare to copy thread state - unlazy all lazy status */
 | 
			
		||||
void prepare_to_copy(struct task_struct *tsk);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * create a kernel thread without removing it from tasklists
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -172,7 +172,6 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 | 
			
		|||
#define copy_segments(p, mm)	do { } while (0)
 | 
			
		||||
#define release_segments(mm)	do { } while (0)
 | 
			
		||||
#define forget_segments()	do { } while (0)
 | 
			
		||||
#define prepare_to_copy(tsk)	do { } while (0)
 | 
			
		||||
/*
 | 
			
		||||
 * FPU lazy state save handling.
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,8 +6,15 @@
 | 
			
		|||
struct kmem_cache *task_xstate_cachep = NULL;
 | 
			
		||||
unsigned int xstate_size;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * this gets called so that we can store lazy state into memory and copy the
 | 
			
		||||
 * current task into the new thread.
 | 
			
		||||
 */
 | 
			
		||||
int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 | 
			
		||||
{
 | 
			
		||||
#ifdef CONFIG_SUPERH32
 | 
			
		||||
	unlazy_fpu(src, task_pt_regs(src));
 | 
			
		||||
#endif
 | 
			
		||||
	*dst = *src;
 | 
			
		||||
 | 
			
		||||
	if (src->thread.xstate) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -155,15 +155,6 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
 | 
			
		|||
}
 | 
			
		||||
EXPORT_SYMBOL(dump_fpu);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This gets called before we allocate a new thread and copy
 | 
			
		||||
 * the current task into it.
 | 
			
		||||
 */
 | 
			
		||||
void prepare_to_copy(struct task_struct *tsk)
 | 
			
		||||
{
 | 
			
		||||
	unlazy_fpu(tsk, task_pt_regs(tsk));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
asmlinkage void ret_from_fork(void);
 | 
			
		||||
 | 
			
		||||
int copy_thread(unsigned long clone_flags, unsigned long usp,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -109,9 +109,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,
 | 
			
		|||
#define release_thread(tsk)		do { } while(0)
 | 
			
		||||
extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 | 
			
		||||
 | 
			
		||||
/* Prepare to copy thread state - unlazy all lazy status */
 | 
			
		||||
#define prepare_to_copy(tsk)	do { } while (0)
 | 
			
		||||
 | 
			
		||||
extern unsigned long get_wchan(struct task_struct *);
 | 
			
		||||
 | 
			
		||||
#define task_pt_regs(tsk) ((tsk)->thread.kregs)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -186,9 +186,6 @@ do { \
 | 
			
		|||
/* Free all resources held by a thread. */
 | 
			
		||||
#define release_thread(tsk)		do { } while (0)
 | 
			
		||||
 | 
			
		||||
/* Prepare to copy thread state - unlazy all lazy status */
 | 
			
		||||
#define prepare_to_copy(tsk)	do { } while (0)
 | 
			
		||||
 | 
			
		||||
extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 | 
			
		||||
 | 
			
		||||
extern unsigned long get_wchan(struct task_struct *task);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -210,9 +210,6 @@ static inline void release_thread(struct task_struct *dead_task)
 | 
			
		|||
	/* Nothing for now */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Prepare to copy thread state - unlazy all lazy status. */
 | 
			
		||||
#define prepare_to_copy(tsk)	do { } while (0)
 | 
			
		||||
 | 
			
		||||
extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
 | 
			
		||||
 | 
			
		||||
extern int do_work_pending(struct pt_regs *regs, u32 flags);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -76,11 +76,6 @@ static inline void release_thread(struct task_struct *task)
 | 
			
		|||
 | 
			
		||||
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 | 
			
		||||
 | 
			
		||||
static inline void prepare_to_copy(struct task_struct *tsk)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
extern unsigned long thread_saved_pc(struct task_struct *t);
 | 
			
		||||
 | 
			
		||||
static inline void mm_copy_segments(struct mm_struct *from_mm,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,9 +68,6 @@ struct task_struct;
 | 
			
		|||
/* Free all resources held by a thread. */
 | 
			
		||||
extern void release_thread(struct task_struct *);
 | 
			
		||||
 | 
			
		||||
/* Prepare to copy thread state - unlazy all lazy status */
 | 
			
		||||
#define prepare_to_copy(tsk)	do { } while (0)
 | 
			
		||||
 | 
			
		||||
unsigned long get_wchan(struct task_struct *p);
 | 
			
		||||
 | 
			
		||||
#define cpu_relax()			barrier()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -579,9 +579,6 @@ extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
 | 
			
		|||
/* Free all resources held by a thread. */
 | 
			
		||||
extern void release_thread(struct task_struct *);
 | 
			
		||||
 | 
			
		||||
/* Prepare to copy thread state - unlazy all lazy state */
 | 
			
		||||
extern void prepare_to_copy(struct task_struct *tsk);
 | 
			
		||||
 | 
			
		||||
unsigned long get_wchan(struct task_struct *p);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,10 +47,16 @@ EXPORT_SYMBOL_GPL(idle_notifier_unregister);
 | 
			
		|||
struct kmem_cache *task_xstate_cachep;
 | 
			
		||||
EXPORT_SYMBOL_GPL(task_xstate_cachep);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * this gets called so that we can store lazy state into memory and copy the
 | 
			
		||||
 * current task into the new thread.
 | 
			
		||||
 */
 | 
			
		||||
int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 | 
			
		||||
{
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
	unlazy_fpu(src);
 | 
			
		||||
 | 
			
		||||
	*dst = *src;
 | 
			
		||||
	if (fpu_allocated(&src->thread.fpu)) {
 | 
			
		||||
		memset(&dst->thread.fpu, 0, sizeof(dst->thread.fpu));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -126,15 +126,6 @@ void release_thread(struct task_struct *dead_task)
 | 
			
		|||
	release_vm86_irqs(dead_task);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This gets called before we allocate a new thread and copy
 | 
			
		||||
 * the current task into it.
 | 
			
		||||
 */
 | 
			
		||||
void prepare_to_copy(struct task_struct *tsk)
 | 
			
		||||
{
 | 
			
		||||
	unlazy_fpu(tsk);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int copy_thread(unsigned long clone_flags, unsigned long sp,
 | 
			
		||||
	unsigned long unused,
 | 
			
		||||
	struct task_struct *p, struct pt_regs *regs)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -145,15 +145,6 @@ static inline u32 read_32bit_tls(struct task_struct *t, int tls)
 | 
			
		|||
	return get_desc_base(&t->thread.tls_array[tls]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This gets called before we allocate a new thread and copy
 | 
			
		||||
 * the current task into it.
 | 
			
		||||
 */
 | 
			
		||||
void prepare_to_copy(struct task_struct *tsk)
 | 
			
		||||
{
 | 
			
		||||
	unlazy_fpu(tsk);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int copy_thread(unsigned long clone_flags, unsigned long sp,
 | 
			
		||||
		unsigned long unused,
 | 
			
		||||
	struct task_struct *p, struct pt_regs *regs)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -168,9 +168,6 @@ struct mm_struct;
 | 
			
		|||
/* Free all resources held by a thread. */
 | 
			
		||||
#define release_thread(thread) do { } while(0)
 | 
			
		||||
 | 
			
		||||
/* Prepare to copy thread state - unlazy all lazy status */
 | 
			
		||||
extern void prepare_to_copy(struct task_struct*);
 | 
			
		||||
 | 
			
		||||
/* Create a kernel thread without removing it from tasklists */
 | 
			
		||||
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -140,13 +140,16 @@ void flush_thread(void)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This is called before the thread is copied. 
 | 
			
		||||
 * this gets called so that we can store coprocessor state into memory and
 | 
			
		||||
 * copy the current task into the new thread.
 | 
			
		||||
 */
 | 
			
		||||
void prepare_to_copy(struct task_struct *tsk)
 | 
			
		||||
int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 | 
			
		||||
{
 | 
			
		||||
#if XTENSA_HAVE_COPROCESSORS
 | 
			
		||||
	coprocessor_flush_all(task_thread_info(tsk));
 | 
			
		||||
	coprocessor_flush_all(task_thread_info(src));
 | 
			
		||||
#endif
 | 
			
		||||
	*dst = *src;
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -261,8 +261,6 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
 | 
			
		|||
	int node = tsk_fork_get_node(orig);
 | 
			
		||||
	int err;
 | 
			
		||||
 | 
			
		||||
	prepare_to_copy(orig);
 | 
			
		||||
 | 
			
		||||
	tsk = alloc_task_struct_node(node);
 | 
			
		||||
	if (!tsk)
 | 
			
		||||
		return NULL;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue