Skip to content

Commit 2be9880

Browse files
Kefeng Wangakpm00
authored andcommitted
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/[email protected] Signed-off-by: Kefeng Wang <[email protected]> Acked-by: Guo Ren <[email protected]> [csky] Acked-by: Russell King (Oracle) <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> Acked-by: Brian Cain <[email protected]> Acked-by: Michael Ellerman <[email protected]> [powerpc] Acked-by: Stafford Horne <[email protected]> [openrisc] Acked-by: Catalin Marinas <[email protected]> [arm64] Acked-by: Huacai Chen <[email protected]> [LoongArch] Cc: Alexander Gordeev <[email protected]> Cc: Anton Ivanov <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Christophe Leroy <[email protected]> Cc: Chris Zankel <[email protected]> Cc: Dave Hansen <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Dinh Nguyen <[email protected]> Cc: Guo Ren <[email protected]> [csky] Cc: Heiko Carstens <[email protected]> Cc: Helge Deller <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Ivan Kokshaysky <[email protected]> Cc: James Bottomley <[email protected]> Cc: Johannes Berg <[email protected]> Cc: Jonas Bonn <[email protected]> Cc: Matt Turner <[email protected]> Cc: Max Filippov <[email protected]> Cc: Michal Simek <[email protected]> Cc: Nicholas Piggin <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Richard Henderson <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: Rich Felker <[email protected]> Cc: Stefan Kristiansson <[email protected]> Cc: Sven Schnelle <[email protected]> Cc: Thomas Bogendoerfer <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Vineet Gupta <[email protected]> Cc: Will Deacon <[email protected]> Cc: Xuerui Wang <[email protected]> Cc: Yoshinori Sato <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent f4068af commit 2be9880

File tree

33 files changed

+7
-118
lines changed

33 files changed

+7
-118
lines changed

arch/alpha/include/asm/processor.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ extern void start_thread(struct pt_regs *, unsigned long, unsigned long);
3636

3737
/* Free all resources held by a thread. */
3838
struct task_struct;
39-
extern void release_thread(struct task_struct *);
40-
4139
unsigned long __get_wchan(struct task_struct *p);
4240

4341
#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)

arch/alpha/kernel/process.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,6 @@ flush_thread(void)
225225
current_thread_info()->pcb.unique = 0;
226226
}
227227

228-
void
229-
release_thread(struct task_struct *dead_task)
230-
{
231-
}
232-
233228
/*
234229
* Copy architecture-specific thread state
235230
*/

arch/arc/include/asm/processor.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ struct task_struct;
4343
#define task_pt_regs(p) \
4444
((struct pt_regs *)(THREAD_SIZE + (void *)task_stack_page(p)) - 1)
4545

46-
/* Free all resources held by a thread */
47-
#define release_thread(thread) do { } while (0)
48-
4946
/*
5047
* A lot of busy-wait loops in SMP are based off of non-volatile data otherwise
5148
* get optimised away by gcc

arch/arm/include/asm/processor.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset,
8181
/* Forward declaration, a strange C thing */
8282
struct task_struct;
8383

84-
/* Free all resources held by a thread. */
85-
extern void release_thread(struct task_struct *);
86-
8784
unsigned long __get_wchan(struct task_struct *p);
8885

8986
#define task_pt_regs(p) \

arch/arm/kernel/process.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,6 @@ void flush_thread(void)
232232
thread_notify(THREAD_NOTIFY_FLUSH, thread);
233233
}
234234

235-
void release_thread(struct task_struct *dead_task)
236-
{
237-
}
238-
239235
asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
240236

241237
int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)

arch/arm64/include/asm/processor.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,6 @@ static inline bool is_ttbr1_addr(unsigned long addr)
323323
/* Forward declaration, a strange C thing */
324324
struct task_struct;
325325

326-
/* Free all resources held by a thread. */
327-
extern void release_thread(struct task_struct *);
328-
329326
unsigned long __get_wchan(struct task_struct *p);
330327

331328
void update_sctlr_el1(u64 sctlr);

arch/arm64/kernel/process.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,6 @@ void flush_thread(void)
279279
flush_tagged_addr_state();
280280
}
281281

282-
void release_thread(struct task_struct *dead_task)
283-
{
284-
}
285-
286282
void arch_release_task_struct(struct task_struct *tsk)
287283
{
288284
fpsimd_release_task(tsk);

arch/csky/include/asm/processor.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@ do { \
6969
/* Forward declaration, a strange C thing */
7070
struct task_struct;
7171

72-
/* Free all resources held by a thread. */
73-
static inline void release_thread(struct task_struct *dead_task)
74-
{
75-
}
76-
7772
/* Prepare to copy thread state - unlazy all lazy status */
7873
#define prepare_to_copy(tsk) do { } while (0)
7974

arch/hexagon/include/asm/processor.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ struct thread_struct {
6060
#define KSTK_EIP(tsk) (pt_elr(task_pt_regs(tsk)))
6161
#define KSTK_ESP(tsk) (pt_psp(task_pt_regs(tsk)))
6262

63-
/* Free all resources held by a thread; defined in process.c */
64-
extern void release_thread(struct task_struct *dead_task);
65-
66-
/* Get wait channel for task P. */
6763
extern unsigned long __get_wchan(struct task_struct *p);
6864

6965
/* The following stuff is pretty HEXAGON specific. */

arch/hexagon/kernel/process.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,6 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
112112
return 0;
113113
}
114114

115-
/*
116-
* Release any architecture-specific resources locked by thread
117-
*/
118-
void release_thread(struct task_struct *dead_task)
119-
{
120-
}
121-
122115
/*
123116
* Some archs flush debug and FPU info here
124117
*/

arch/ia64/include/asm/processor.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -318,13 +318,6 @@ struct thread_struct {
318318
struct mm_struct;
319319
struct task_struct;
320320

321-
/*
322-
* Free all resources held by a thread. This is called after the
323-
* parent of DEAD_TASK has collected the exit status of the task via
324-
* wait().
325-
*/
326-
#define release_thread(dead_task)
327-
328321
/* Get wait channel for task P. */
329322
extern unsigned long __get_wchan (struct task_struct *p);
330323

arch/loongarch/include/asm/processor.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,6 @@ struct thread_struct {
176176

177177
struct task_struct;
178178

179-
/* Free all resources held by a thread. */
180-
#define release_thread(thread) do { } while (0)
181-
182179
enum idle_boot_override {IDLE_NO_OVERRIDE = 0, IDLE_HALT, IDLE_NOMWAIT, IDLE_POLL};
183180

184181
extern unsigned long boot_option_idle_override;

arch/m68k/include/asm/processor.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,
145145
/* Forward declaration, a strange C thing */
146146
struct task_struct;
147147

148-
/* Free all resources held by a thread. */
149-
static inline void release_thread(struct task_struct *dead_task)
150-
{
151-
}
152-
153148
unsigned long __get_wchan(struct task_struct *p);
154149
void show_registers(struct pt_regs *regs);
155150

arch/microblaze/include/asm/processor.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ struct thread_struct {
6363
.pgdir = swapper_pg_dir, \
6464
}
6565

66-
/* Free all resources held by a thread. */
67-
static inline void release_thread(struct task_struct *dead_task)
68-
{
69-
}
70-
7166
unsigned long __get_wchan(struct task_struct *p);
7267

7368
/* The size allocated for kernel stacks. This _must_ be a power of two! */

arch/mips/include/asm/processor.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,6 @@ struct thread_struct {
344344

345345
struct task_struct;
346346

347-
/* Free all resources held by a thread. */
348-
#define release_thread(thread) do { } while(0)
349-
350347
/*
351348
* Do necessary setup to start up a newly executed thread.
352349
*/

arch/nios2/include/asm/processor.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ extern void start_thread(struct pt_regs *regs, unsigned long pc,
6464

6565
struct task_struct;
6666

67-
/* Free all resources held by a thread. */
68-
static inline void release_thread(struct task_struct *dead_task)
69-
{
70-
}
71-
7267
extern unsigned long __get_wchan(struct task_struct *p);
7368

7469
#define task_pt_regs(p) \

arch/openrisc/include/asm/processor.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ struct thread_struct {
7272

7373

7474
void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp);
75-
void release_thread(struct task_struct *);
7675
unsigned long __get_wchan(struct task_struct *p);
7776

7877
#define cpu_relax() barrier()

arch/openrisc/kernel/process.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,6 @@ void show_regs(struct pt_regs *regs)
125125
show_registers(regs);
126126
}
127127

128-
void release_thread(struct task_struct *dead_task)
129-
{
130-
}
131-
132128
/*
133129
* Copy the thread-specific (arch specific) info from the current
134130
* process to the new one p

arch/parisc/include/asm/processor.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,6 @@ on downward growing arches, it looks like this:
266266

267267
struct mm_struct;
268268

269-
/* Free all resources held by a thread. */
270-
extern void release_thread(struct task_struct *);
271-
272269
extern unsigned long __get_wchan(struct task_struct *p);
273270

274271
#define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0])

arch/parisc/kernel/process.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,6 @@ void flush_thread(void)
146146
*/
147147
}
148148

149-
void release_thread(struct task_struct *dead_task)
150-
{
151-
}
152-
153149
/*
154150
* Idle thread support
155151
*

arch/powerpc/include/asm/processor.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ extern int _chrp_type;
7575

7676
struct task_struct;
7777
void start_thread(struct pt_regs *regs, unsigned long fdptr, unsigned long sp);
78-
void release_thread(struct task_struct *);
7978

8079
#define TS_FPR(i) fp_state.fpr[i][TS_FPROFFSET]
8180
#define TS_CKFPR(i) ckfp_state.fpr[i][TS_FPROFFSET]

arch/powerpc/kernel/process.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,11 +1655,6 @@ EXPORT_SYMBOL_GPL(set_thread_tidr);
16551655

16561656
#endif /* CONFIG_PPC64 */
16571657

1658-
void
1659-
release_thread(struct task_struct *t)
1660-
{
1661-
}
1662-
16631658
/*
16641659
* this gets called so that we can store coprocessor state into memory and
16651660
* copy the current task into the new thread.

arch/riscv/include/asm/processor.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset,
6565
extern void start_thread(struct pt_regs *regs,
6666
unsigned long pc, unsigned long sp);
6767

68-
/* Free all resources held by a thread. */
69-
static inline void release_thread(struct task_struct *dead_task)
70-
{
71-
}
72-
7368
extern unsigned long __get_wchan(struct task_struct *p);
7469

7570

arch/s390/include/asm/processor.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,6 @@ struct pt_regs;
186186
void show_registers(struct pt_regs *regs);
187187
void show_cacheinfo(struct seq_file *m);
188188

189-
/* Free all resources held by a thread. */
190-
static inline void release_thread(struct task_struct *tsk) { }
191-
192189
/* Free guarded storage control block */
193190
void guarded_storage_release(struct task_struct *tsk);
194191
void gs_load_bc_cb(struct pt_regs *regs);

arch/sh/include/asm/processor_32.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ struct task_struct;
127127

128128
extern void start_thread(struct pt_regs *regs, unsigned long new_pc, unsigned long new_sp);
129129

130-
/* Free all resources held by a thread. */
131-
extern void release_thread(struct task_struct *);
132-
133130
/*
134131
* FPU lazy state save handling.
135132
*/

arch/sh/kernel/process_32.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,6 @@ void flush_thread(void)
8484
#endif
8585
}
8686

87-
void release_thread(struct task_struct *dead_task)
88-
{
89-
/* do nothing */
90-
}
91-
9287
asmlinkage void ret_from_fork(void);
9388
asmlinkage void ret_from_kernel_thread(void);
9489

arch/sparc/include/asm/processor_32.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,
8080
: "memory");
8181
}
8282

83-
/* Free all resources held by a thread. */
84-
#define release_thread(tsk) do { } while(0)
85-
8683
unsigned long __get_wchan(struct task_struct *);
8784

8885
#define task_pt_regs(tsk) ((tsk)->thread.kregs)

arch/sparc/include/asm/processor_64.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,6 @@ do { \
176176
regs->tstate &= ~TSTATE_PEF; \
177177
} while (0)
178178

179-
/* Free all resources held by a thread. */
180-
#define release_thread(tsk) do { } while (0)
181-
182179
unsigned long __get_wchan(struct task_struct *task);
183180

184181
#define task_pt_regs(tsk) (task_thread_info(tsk)->kregs)

arch/um/include/asm/processor-generic.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ struct thread_struct {
5555
.request = { 0 } \
5656
}
5757

58-
static inline void release_thread(struct task_struct *task)
59-
{
60-
}
61-
6258
/*
6359
* User space process size: 3GB (default).
6460
*/

arch/x86/include/asm/processor.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,6 @@ static inline void load_sp0(unsigned long sp0)
587587

588588
#endif /* CONFIG_PARAVIRT_XXL */
589589

590-
/* Free all resources held by a thread. */
591-
extern void release_thread(struct task_struct *);
592-
593590
unsigned long __get_wchan(struct task_struct *p);
594591

595592
/*

arch/xtensa/include/asm/processor.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,6 @@ struct thread_struct {
221221
struct task_struct;
222222
struct mm_struct;
223223

224-
/* Free all resources held by a thread. */
225-
#define release_thread(thread) do { } while(0)
226-
227224
extern unsigned long __get_wchan(struct task_struct *p);
228225

229226
#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)

include/linux/sched/task.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ static inline void put_task_struct_many(struct task_struct *t, int nr)
127127

128128
void put_task_struct_rcu_user(struct task_struct *task);
129129

130+
/* Free all architecture-specific resources held by a thread. */
131+
void release_thread(struct task_struct *dead_task);
132+
130133
#ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT
131134
extern int arch_task_struct_size __read_mostly;
132135
#else

kernel/exit.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ void put_task_struct_rcu_user(struct task_struct *task)
183183
call_rcu(&task->rcu, delayed_put_task_struct);
184184
}
185185

186+
void __weak release_thread(struct task_struct *dead_task)
187+
{
188+
}
189+
186190
void release_task(struct task_struct *p)
187191
{
188192
struct task_struct *leader;

0 commit comments

Comments
 (0)