Commit 2be9880d authored by Kefeng Wang's avatar Kefeng Wang Committed by Andrew Morton

kernel: exit: cleanup release_thread()

Only x86 has own release_thread(), introduce a new weak release_thread()
function to clean empty definitions in other ARCHs.

Link: https://lkml.kernel.org/r/20220819014406.32266-1-wangkefeng.wang@huawei.comSigned-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Acked-by: Guo Ren <guoren@kernel.org>				[csky]
Acked-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Acked-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Acked-by: default avatarBrian Cain <bcain@quicinc.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>			[powerpc]
Acked-by: Stafford Horne <shorne@gmail.com>			[openrisc]
Acked-by: Catalin Marinas <catalin.marinas@arm.com>		[arm64]
Acked-by: Huacai Chen <chenhuacai@kernel.org>			[LoongArch]
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Chris Zankel <chris@zankel.net>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Guo Ren <guoren@kernel.org> [csky]
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Richard Weinberger <richard@nod.at>
Cc: Rich Felker <dalias@libc.org>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: Xuerui Wang <kernel@xen0n.name>
Cc: Yoshinori Sato <ysato@users.osdn.me>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent f4068af3
...@@ -36,8 +36,6 @@ extern void start_thread(struct pt_regs *, unsigned long, unsigned long); ...@@ -36,8 +36,6 @@ extern void start_thread(struct pt_regs *, unsigned long, unsigned long);
/* Free all resources held by a thread. */ /* Free all resources held by a thread. */
struct task_struct; struct task_struct;
extern void release_thread(struct task_struct *);
unsigned long __get_wchan(struct task_struct *p); unsigned long __get_wchan(struct task_struct *p);
#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
......
...@@ -225,11 +225,6 @@ flush_thread(void) ...@@ -225,11 +225,6 @@ flush_thread(void)
current_thread_info()->pcb.unique = 0; current_thread_info()->pcb.unique = 0;
} }
void
release_thread(struct task_struct *dead_task)
{
}
/* /*
* Copy architecture-specific thread state * Copy architecture-specific thread state
*/ */
......
...@@ -43,9 +43,6 @@ struct task_struct; ...@@ -43,9 +43,6 @@ struct task_struct;
#define task_pt_regs(p) \ #define task_pt_regs(p) \
((struct pt_regs *)(THREAD_SIZE + (void *)task_stack_page(p)) - 1) ((struct pt_regs *)(THREAD_SIZE + (void *)task_stack_page(p)) - 1)
/* Free all resources held by a thread */
#define release_thread(thread) do { } while (0)
/* /*
* A lot of busy-wait loops in SMP are based off of non-volatile data otherwise * A lot of busy-wait loops in SMP are based off of non-volatile data otherwise
* get optimised away by gcc * get optimised away by gcc
......
...@@ -81,9 +81,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, ...@@ -81,9 +81,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset,
/* Forward declaration, a strange C thing */ /* Forward declaration, a strange C thing */
struct task_struct; struct task_struct;
/* Free all resources held by a thread. */
extern void release_thread(struct task_struct *);
unsigned long __get_wchan(struct task_struct *p); unsigned long __get_wchan(struct task_struct *p);
#define task_pt_regs(p) \ #define task_pt_regs(p) \
......
...@@ -232,10 +232,6 @@ void flush_thread(void) ...@@ -232,10 +232,6 @@ void flush_thread(void)
thread_notify(THREAD_NOTIFY_FLUSH, thread); thread_notify(THREAD_NOTIFY_FLUSH, thread);
} }
void release_thread(struct task_struct *dead_task)
{
}
asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
......
...@@ -323,9 +323,6 @@ static inline bool is_ttbr1_addr(unsigned long addr) ...@@ -323,9 +323,6 @@ static inline bool is_ttbr1_addr(unsigned long addr)
/* Forward declaration, a strange C thing */ /* Forward declaration, a strange C thing */
struct task_struct; struct task_struct;
/* Free all resources held by a thread. */
extern void release_thread(struct task_struct *);
unsigned long __get_wchan(struct task_struct *p); unsigned long __get_wchan(struct task_struct *p);
void update_sctlr_el1(u64 sctlr); void update_sctlr_el1(u64 sctlr);
......
...@@ -279,10 +279,6 @@ void flush_thread(void) ...@@ -279,10 +279,6 @@ void flush_thread(void)
flush_tagged_addr_state(); flush_tagged_addr_state();
} }
void release_thread(struct task_struct *dead_task)
{
}
void arch_release_task_struct(struct task_struct *tsk) void arch_release_task_struct(struct task_struct *tsk)
{ {
fpsimd_release_task(tsk); fpsimd_release_task(tsk);
......
...@@ -69,11 +69,6 @@ do { \ ...@@ -69,11 +69,6 @@ do { \
/* Forward declaration, a strange C thing */ /* Forward declaration, a strange C thing */
struct task_struct; struct task_struct;
/* Free all resources held by a thread. */
static inline void release_thread(struct task_struct *dead_task)
{
}
/* Prepare to copy thread state - unlazy all lazy status */ /* Prepare to copy thread state - unlazy all lazy status */
#define prepare_to_copy(tsk) do { } while (0) #define prepare_to_copy(tsk) do { } while (0)
......
...@@ -60,10 +60,6 @@ struct thread_struct { ...@@ -60,10 +60,6 @@ struct thread_struct {
#define KSTK_EIP(tsk) (pt_elr(task_pt_regs(tsk))) #define KSTK_EIP(tsk) (pt_elr(task_pt_regs(tsk)))
#define KSTK_ESP(tsk) (pt_psp(task_pt_regs(tsk))) #define KSTK_ESP(tsk) (pt_psp(task_pt_regs(tsk)))
/* Free all resources held by a thread; defined in process.c */
extern void release_thread(struct task_struct *dead_task);
/* Get wait channel for task P. */
extern unsigned long __get_wchan(struct task_struct *p); extern unsigned long __get_wchan(struct task_struct *p);
/* The following stuff is pretty HEXAGON specific. */ /* The following stuff is pretty HEXAGON specific. */
......
...@@ -112,13 +112,6 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) ...@@ -112,13 +112,6 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
return 0; return 0;
} }
/*
* Release any architecture-specific resources locked by thread
*/
void release_thread(struct task_struct *dead_task)
{
}
/* /*
* Some archs flush debug and FPU info here * Some archs flush debug and FPU info here
*/ */
......
...@@ -318,13 +318,6 @@ struct thread_struct { ...@@ -318,13 +318,6 @@ struct thread_struct {
struct mm_struct; struct mm_struct;
struct task_struct; struct task_struct;
/*
* Free all resources held by a thread. This is called after the
* parent of DEAD_TASK has collected the exit status of the task via
* wait().
*/
#define release_thread(dead_task)
/* Get wait channel for task P. */ /* Get wait channel for task P. */
extern unsigned long __get_wchan (struct task_struct *p); extern unsigned long __get_wchan (struct task_struct *p);
......
...@@ -176,9 +176,6 @@ struct thread_struct { ...@@ -176,9 +176,6 @@ struct thread_struct {
struct task_struct; struct task_struct;
/* Free all resources held by a thread. */
#define release_thread(thread) do { } while (0)
enum idle_boot_override {IDLE_NO_OVERRIDE = 0, IDLE_HALT, IDLE_NOMWAIT, IDLE_POLL}; enum idle_boot_override {IDLE_NO_OVERRIDE = 0, IDLE_HALT, IDLE_NOMWAIT, IDLE_POLL};
extern unsigned long boot_option_idle_override; extern unsigned long boot_option_idle_override;
......
...@@ -145,11 +145,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc, ...@@ -145,11 +145,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,
/* Forward declaration, a strange C thing */ /* Forward declaration, a strange C thing */
struct task_struct; struct task_struct;
/* Free all resources held by a thread. */
static inline void release_thread(struct task_struct *dead_task)
{
}
unsigned long __get_wchan(struct task_struct *p); unsigned long __get_wchan(struct task_struct *p);
void show_registers(struct pt_regs *regs); void show_registers(struct pt_regs *regs);
......
...@@ -63,11 +63,6 @@ struct thread_struct { ...@@ -63,11 +63,6 @@ struct thread_struct {
.pgdir = swapper_pg_dir, \ .pgdir = swapper_pg_dir, \
} }
/* Free all resources held by a thread. */
static inline void release_thread(struct task_struct *dead_task)
{
}
unsigned long __get_wchan(struct task_struct *p); unsigned long __get_wchan(struct task_struct *p);
/* The size allocated for kernel stacks. This _must_ be a power of two! */ /* The size allocated for kernel stacks. This _must_ be a power of two! */
......
...@@ -344,9 +344,6 @@ struct thread_struct { ...@@ -344,9 +344,6 @@ struct thread_struct {
struct task_struct; struct task_struct;
/* Free all resources held by a thread. */
#define release_thread(thread) do { } while(0)
/* /*
* Do necessary setup to start up a newly executed thread. * Do necessary setup to start up a newly executed thread.
*/ */
......
...@@ -64,11 +64,6 @@ extern void start_thread(struct pt_regs *regs, unsigned long pc, ...@@ -64,11 +64,6 @@ extern void start_thread(struct pt_regs *regs, unsigned long pc,
struct task_struct; struct task_struct;
/* Free all resources held by a thread. */
static inline void release_thread(struct task_struct *dead_task)
{
}
extern unsigned long __get_wchan(struct task_struct *p); extern unsigned long __get_wchan(struct task_struct *p);
#define task_pt_regs(p) \ #define task_pt_regs(p) \
......
...@@ -72,7 +72,6 @@ struct thread_struct { ...@@ -72,7 +72,6 @@ struct thread_struct {
void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp); void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp);
void release_thread(struct task_struct *);
unsigned long __get_wchan(struct task_struct *p); unsigned long __get_wchan(struct task_struct *p);
#define cpu_relax() barrier() #define cpu_relax() barrier()
......
...@@ -125,10 +125,6 @@ void show_regs(struct pt_regs *regs) ...@@ -125,10 +125,6 @@ void show_regs(struct pt_regs *regs)
show_registers(regs); show_registers(regs);
} }
void release_thread(struct task_struct *dead_task)
{
}
/* /*
* Copy the thread-specific (arch specific) info from the current * Copy the thread-specific (arch specific) info from the current
* process to the new one p * process to the new one p
......
...@@ -266,9 +266,6 @@ on downward growing arches, it looks like this: ...@@ -266,9 +266,6 @@ on downward growing arches, it looks like this:
struct mm_struct; struct mm_struct;
/* Free all resources held by a thread. */
extern void release_thread(struct task_struct *);
extern unsigned long __get_wchan(struct task_struct *p); extern unsigned long __get_wchan(struct task_struct *p);
#define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0]) #define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0])
......
...@@ -146,10 +146,6 @@ void flush_thread(void) ...@@ -146,10 +146,6 @@ void flush_thread(void)
*/ */
} }
void release_thread(struct task_struct *dead_task)
{
}
/* /*
* Idle thread support * Idle thread support
* *
......
...@@ -75,7 +75,6 @@ extern int _chrp_type; ...@@ -75,7 +75,6 @@ extern int _chrp_type;
struct task_struct; struct task_struct;
void start_thread(struct pt_regs *regs, unsigned long fdptr, unsigned long sp); void start_thread(struct pt_regs *regs, unsigned long fdptr, unsigned long sp);
void release_thread(struct task_struct *);
#define TS_FPR(i) fp_state.fpr[i][TS_FPROFFSET] #define TS_FPR(i) fp_state.fpr[i][TS_FPROFFSET]
#define TS_CKFPR(i) ckfp_state.fpr[i][TS_FPROFFSET] #define TS_CKFPR(i) ckfp_state.fpr[i][TS_FPROFFSET]
......
...@@ -1655,11 +1655,6 @@ EXPORT_SYMBOL_GPL(set_thread_tidr); ...@@ -1655,11 +1655,6 @@ EXPORT_SYMBOL_GPL(set_thread_tidr);
#endif /* CONFIG_PPC64 */ #endif /* CONFIG_PPC64 */
void
release_thread(struct task_struct *t)
{
}
/* /*
* this gets called so that we can store coprocessor state into memory and * this gets called so that we can store coprocessor state into memory and
* copy the current task into the new thread. * copy the current task into the new thread.
......
...@@ -65,11 +65,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, ...@@ -65,11 +65,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset,
extern void start_thread(struct pt_regs *regs, extern void start_thread(struct pt_regs *regs,
unsigned long pc, unsigned long sp); unsigned long pc, unsigned long sp);
/* Free all resources held by a thread. */
static inline void release_thread(struct task_struct *dead_task)
{
}
extern unsigned long __get_wchan(struct task_struct *p); extern unsigned long __get_wchan(struct task_struct *p);
......
...@@ -186,9 +186,6 @@ struct pt_regs; ...@@ -186,9 +186,6 @@ struct pt_regs;
void show_registers(struct pt_regs *regs); void show_registers(struct pt_regs *regs);
void show_cacheinfo(struct seq_file *m); void show_cacheinfo(struct seq_file *m);
/* Free all resources held by a thread. */
static inline void release_thread(struct task_struct *tsk) { }
/* Free guarded storage control block */ /* Free guarded storage control block */
void guarded_storage_release(struct task_struct *tsk); void guarded_storage_release(struct task_struct *tsk);
void gs_load_bc_cb(struct pt_regs *regs); void gs_load_bc_cb(struct pt_regs *regs);
......
...@@ -127,9 +127,6 @@ struct task_struct; ...@@ -127,9 +127,6 @@ struct task_struct;
extern void start_thread(struct pt_regs *regs, unsigned long new_pc, unsigned long new_sp); extern void start_thread(struct pt_regs *regs, unsigned long new_pc, unsigned long new_sp);
/* Free all resources held by a thread. */
extern void release_thread(struct task_struct *);
/* /*
* FPU lazy state save handling. * FPU lazy state save handling.
*/ */
......
...@@ -84,11 +84,6 @@ void flush_thread(void) ...@@ -84,11 +84,6 @@ void flush_thread(void)
#endif #endif
} }
void release_thread(struct task_struct *dead_task)
{
/* do nothing */
}
asmlinkage void ret_from_fork(void); asmlinkage void ret_from_fork(void);
asmlinkage void ret_from_kernel_thread(void); asmlinkage void ret_from_kernel_thread(void);
......
...@@ -80,9 +80,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc, ...@@ -80,9 +80,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,
: "memory"); : "memory");
} }
/* Free all resources held by a thread. */
#define release_thread(tsk) do { } while(0)
unsigned long __get_wchan(struct task_struct *); unsigned long __get_wchan(struct task_struct *);
#define task_pt_regs(tsk) ((tsk)->thread.kregs) #define task_pt_regs(tsk) ((tsk)->thread.kregs)
......
...@@ -176,9 +176,6 @@ do { \ ...@@ -176,9 +176,6 @@ do { \
regs->tstate &= ~TSTATE_PEF; \ regs->tstate &= ~TSTATE_PEF; \
} while (0) } while (0)
/* Free all resources held by a thread. */
#define release_thread(tsk) do { } while (0)
unsigned long __get_wchan(struct task_struct *task); unsigned long __get_wchan(struct task_struct *task);
#define task_pt_regs(tsk) (task_thread_info(tsk)->kregs) #define task_pt_regs(tsk) (task_thread_info(tsk)->kregs)
......
...@@ -55,10 +55,6 @@ struct thread_struct { ...@@ -55,10 +55,6 @@ struct thread_struct {
.request = { 0 } \ .request = { 0 } \
} }
static inline void release_thread(struct task_struct *task)
{
}
/* /*
* User space process size: 3GB (default). * User space process size: 3GB (default).
*/ */
......
...@@ -587,9 +587,6 @@ static inline void load_sp0(unsigned long sp0) ...@@ -587,9 +587,6 @@ static inline void load_sp0(unsigned long sp0)
#endif /* CONFIG_PARAVIRT_XXL */ #endif /* CONFIG_PARAVIRT_XXL */
/* Free all resources held by a thread. */
extern void release_thread(struct task_struct *);
unsigned long __get_wchan(struct task_struct *p); unsigned long __get_wchan(struct task_struct *p);
/* /*
......
...@@ -221,9 +221,6 @@ struct thread_struct { ...@@ -221,9 +221,6 @@ struct thread_struct {
struct task_struct; struct task_struct;
struct mm_struct; struct mm_struct;
/* Free all resources held by a thread. */
#define release_thread(thread) do { } while(0)
extern unsigned long __get_wchan(struct task_struct *p); extern unsigned long __get_wchan(struct task_struct *p);
#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
......
...@@ -127,6 +127,9 @@ static inline void put_task_struct_many(struct task_struct *t, int nr) ...@@ -127,6 +127,9 @@ static inline void put_task_struct_many(struct task_struct *t, int nr)
void put_task_struct_rcu_user(struct task_struct *task); void put_task_struct_rcu_user(struct task_struct *task);
/* Free all architecture-specific resources held by a thread. */
void release_thread(struct task_struct *dead_task);
#ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT #ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT
extern int arch_task_struct_size __read_mostly; extern int arch_task_struct_size __read_mostly;
#else #else
......
...@@ -183,6 +183,10 @@ void put_task_struct_rcu_user(struct task_struct *task) ...@@ -183,6 +183,10 @@ void put_task_struct_rcu_user(struct task_struct *task)
call_rcu(&task->rcu, delayed_put_task_struct); call_rcu(&task->rcu, delayed_put_task_struct);
} }
void __weak release_thread(struct task_struct *dead_task)
{
}
void release_task(struct task_struct *p) void release_task(struct task_struct *p)
{ {
struct task_struct *leader; struct task_struct *leader;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment