From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBA32193 for ; Fri, 19 Aug 2022 01:47:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BBCCC433B5 for ; Fri, 19 Aug 2022 01:47:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660873679; bh=5JatSOxYSIl5vDUQiorJPobY5OCnJz2Lpd3CiqC5c7c=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=l1VpVxb9+/uj8bKIAXg/Mut6CO8Y4N4PGBe3l8rhrcw2NGJ7rkYTZs0BUkUw5Iw7Q kiMO7yWB2kTyXuUZKUtEN8szpFZfbHT02aLE7EhKzQGzKqEjNybmGySEZu9Bk7uyjN pxo18oyP+m1UnFcaQx7KVSafiGJoHbklZf5aJS9vgbHjRJlvS7vsMBXsr2/TVsgd84 q14ojlU3KS0n8T/kJ74uG0Bb3WmFE6CyOR5vhSCMgyLEJySAGfecCWiNj4bRWeep1q JWN7pKHyMNuUNP4QoTKxXyET859lDjyC1Fatxx+xdzZ92kv+Et6f9j/USNASfuX6Lf jIqnmKikxyj1w== Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-10edfa2d57dso3809918fac.0 for ; Thu, 18 Aug 2022 18:47:59 -0700 (PDT) X-Gm-Message-State: ACgBeo1oREhoOtfVNpy7Hkpuf2WkwPwA8+/9APrNrltPLQar+ss+hy1F 3RxTP4LzAdJrWl9Q1FdssbSE5A1gOZtvTUiCFLo= X-Google-Smtp-Source: AA6agR4OyqmepS4+VTsu9a8dSLWpo0jz7CjT66zOKAEPn9pWyDEV5uDKfXPjUxFtFMX/enUe8dxNMNdryyp/ovEVZgs= X-Received: by 2002:a05:6870:c596:b0:101:6409:ae62 with SMTP id ba22-20020a056870c59600b001016409ae62mr5559480oab.112.1660873668265; Thu, 18 Aug 2022 18:47:48 -0700 (PDT) Precedence: bulk X-Mailing-List: loongarch@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20220819014406.32266-1-wangkefeng.wang@huawei.com> In-Reply-To: <20220819014406.32266-1-wangkefeng.wang@huawei.com> From: Guo Ren Date: Fri, 19 Aug 2022 09:47:34 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kernel: exit: cleanup release_thread() To: Kefeng Wang Cc: Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Catalin Marinas , Will Deacon , Brian Cain , Huacai Chen , WANG Xuerui , Geert Uytterhoeven , Michal Simek , Thomas Bogendoerfer , Dinh Nguyen , Jonas Bonn , Stefan Kristiansson , Stafford Horne , "James E . J . Bottomley" , Helge Deller , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Paul Walmsley , Palmer Dabbelt , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Yoshinori Sato , Rich Felker , "David S . Miller" , Richard Weinberger , Anton Ivanov , Johannes Berg , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Chris Zankel , Max Filippov , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, linux-xtensa@linux-xtensa.org, akpm@linux-foundation.org Content-Type: text/plain; charset="UTF-8" For csky part Acked-by: Guo Ren On Fri, Aug 19, 2022 at 9:39 AM Kefeng Wang wrote: > > Only x86 has own release_thread(), introduce a new weak > release_thread() function to clean empty definitions in > other ARCHs. > > Signed-off-by: Kefeng Wang > --- > arch/alpha/include/asm/processor.h | 2 -- > arch/alpha/kernel/process.c | 5 ----- > arch/arc/include/asm/processor.h | 3 --- > arch/arm/include/asm/processor.h | 3 --- > arch/arm/kernel/process.c | 4 ---- > arch/arm64/include/asm/processor.h | 3 --- > arch/arm64/kernel/process.c | 4 ---- > arch/csky/include/asm/processor.h | 5 ----- > arch/hexagon/include/asm/processor.h | 4 ---- > arch/hexagon/kernel/process.c | 7 ------- > arch/ia64/include/asm/processor.h | 7 ------- > arch/loongarch/include/asm/processor.h | 3 --- > arch/m68k/include/asm/processor.h | 5 ----- > arch/microblaze/include/asm/processor.h | 5 ----- > arch/mips/include/asm/processor.h | 3 --- > arch/nios2/include/asm/processor.h | 5 ----- > arch/openrisc/include/asm/processor.h | 1 - > arch/openrisc/kernel/process.c | 4 ---- > arch/parisc/include/asm/processor.h | 3 --- > arch/parisc/kernel/process.c | 4 ---- > arch/powerpc/include/asm/processor.h | 1 - > arch/powerpc/kernel/process.c | 5 ----- > arch/riscv/include/asm/processor.h | 5 ----- > arch/s390/include/asm/processor.h | 3 --- > arch/sh/include/asm/processor_32.h | 3 --- > arch/sh/kernel/process_32.c | 5 ----- > arch/sparc/include/asm/processor_32.h | 3 --- > arch/sparc/include/asm/processor_64.h | 3 --- > arch/um/include/asm/processor-generic.h | 4 ---- > arch/x86/include/asm/processor.h | 3 --- > arch/xtensa/include/asm/processor.h | 3 --- > include/linux/sched/task.h | 3 +++ > kernel/exit.c | 4 ++++ > 33 files changed, 7 insertions(+), 118 deletions(-) > > diff --git a/arch/alpha/include/asm/processor.h b/arch/alpha/include/asm/processor.h > index 43e234c518b1..714abe494e5f 100644 > --- a/arch/alpha/include/asm/processor.h > +++ b/arch/alpha/include/asm/processor.h > @@ -36,8 +36,6 @@ extern void start_thread(struct pt_regs *, unsigned long, unsigned long); > > /* Free all resources held by a thread. */ > struct task_struct; > -extern void release_thread(struct task_struct *); > - > unsigned long __get_wchan(struct task_struct *p); > > #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) > diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c > index e2e25f8b5e76..dbf1bc5e2ad2 100644 > --- a/arch/alpha/kernel/process.c > +++ b/arch/alpha/kernel/process.c > @@ -225,11 +225,6 @@ flush_thread(void) > current_thread_info()->pcb.unique = 0; > } > > -void > -release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Copy architecture-specific thread state > */ > diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h > index 54db9d7bb562..fb844fce1ab6 100644 > --- a/arch/arc/include/asm/processor.h > +++ b/arch/arc/include/asm/processor.h > @@ -43,9 +43,6 @@ struct task_struct; > #define task_pt_regs(p) \ > ((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 > * get optimised away by gcc > diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h > index bdc35c0e8dfb..326864f79d18 100644 > --- a/arch/arm/include/asm/processor.h > +++ b/arch/arm/include/asm/processor.h > @@ -81,9 +81,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, > /* Forward declaration, a strange C thing */ > 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); > > #define task_pt_regs(p) \ > diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c > index 3d9cace63884..712d3e6d9be9 100644 > --- a/arch/arm/kernel/process.c > +++ b/arch/arm/kernel/process.c > @@ -232,10 +232,6 @@ void flush_thread(void) > thread_notify(THREAD_NOTIFY_FLUSH, thread); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); > > int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) > diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h > index 86eb0bfe3b38..4cfb4cd1d475 100644 > --- a/arch/arm64/include/asm/processor.h > +++ b/arch/arm64/include/asm/processor.h > @@ -323,9 +323,6 @@ static inline bool is_ttbr1_addr(unsigned long addr) > /* Forward declaration, a strange C thing */ > 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); > > void update_sctlr_el1(u64 sctlr); > diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c > index 92bcc1768f0b..9015f49c206e 100644 > --- a/arch/arm64/kernel/process.c > +++ b/arch/arm64/kernel/process.c > @@ -279,10 +279,6 @@ void flush_thread(void) > flush_tagged_addr_state(); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > void arch_release_task_struct(struct task_struct *tsk) > { > fpsimd_release_task(tsk); > diff --git a/arch/csky/include/asm/processor.h b/arch/csky/include/asm/processor.h > index 9638206bc44f..63ad71fab30d 100644 > --- a/arch/csky/include/asm/processor.h > +++ b/arch/csky/include/asm/processor.h > @@ -69,11 +69,6 @@ do { \ > /* Forward declaration, a strange C thing */ > 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 */ > #define prepare_to_copy(tsk) do { } while (0) > > diff --git a/arch/hexagon/include/asm/processor.h b/arch/hexagon/include/asm/processor.h > index 615f7e49968e..0cd39c2cdf8f 100644 > --- a/arch/hexagon/include/asm/processor.h > +++ b/arch/hexagon/include/asm/processor.h > @@ -60,10 +60,6 @@ struct thread_struct { > #define KSTK_EIP(tsk) (pt_elr(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); > > /* The following stuff is pretty HEXAGON specific. */ > diff --git a/arch/hexagon/kernel/process.c b/arch/hexagon/kernel/process.c > index f0552f98a7ba..e15eeaebd785 100644 > --- a/arch/hexagon/kernel/process.c > +++ b/arch/hexagon/kernel/process.c > @@ -112,13 +112,6 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) > 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 > */ > diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h > index 757c2f6d8d4b..d1978e004054 100644 > --- a/arch/ia64/include/asm/processor.h > +++ b/arch/ia64/include/asm/processor.h > @@ -318,13 +318,6 @@ struct thread_struct { > struct mm_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. */ > extern unsigned long __get_wchan (struct task_struct *p); > > diff --git a/arch/loongarch/include/asm/processor.h b/arch/loongarch/include/asm/processor.h > index 1c4b4308378d..6954dc5d24e9 100644 > --- a/arch/loongarch/include/asm/processor.h > +++ b/arch/loongarch/include/asm/processor.h > @@ -176,9 +176,6 @@ struct thread_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}; > > extern unsigned long boot_option_idle_override; > diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h > index d86b4009880b..7a2da780830b 100644 > --- a/arch/m68k/include/asm/processor.h > +++ b/arch/m68k/include/asm/processor.h > @@ -145,11 +145,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc, > /* Forward declaration, a strange C thing */ > 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); > void show_registers(struct pt_regs *regs); > > diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h > index 7e9e92670df3..4e193c7550df 100644 > --- a/arch/microblaze/include/asm/processor.h > +++ b/arch/microblaze/include/asm/processor.h > @@ -63,11 +63,6 @@ struct thread_struct { > .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); > > /* The size allocated for kernel stacks. This _must_ be a power of two! */ > diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h > index 4bb24579d12e..3fde1ff72bd1 100644 > --- a/arch/mips/include/asm/processor.h > +++ b/arch/mips/include/asm/processor.h > @@ -344,9 +344,6 @@ struct thread_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. > */ > diff --git a/arch/nios2/include/asm/processor.h b/arch/nios2/include/asm/processor.h > index b8125dfbcad2..8916d93d5c2d 100644 > --- a/arch/nios2/include/asm/processor.h > +++ b/arch/nios2/include/asm/processor.h > @@ -64,11 +64,6 @@ extern void start_thread(struct pt_regs *regs, unsigned long pc, > > 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); > > #define task_pt_regs(p) \ > diff --git a/arch/openrisc/include/asm/processor.h b/arch/openrisc/include/asm/processor.h > index aa1699c18add..ed9efb430afa 100644 > --- a/arch/openrisc/include/asm/processor.h > +++ b/arch/openrisc/include/asm/processor.h > @@ -72,7 +72,6 @@ struct thread_struct { > > > 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); > > #define cpu_relax() barrier() > diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c > index 52dc983ddeba..f94b5ec06786 100644 > --- a/arch/openrisc/kernel/process.c > +++ b/arch/openrisc/kernel/process.c > @@ -125,10 +125,6 @@ void show_regs(struct pt_regs *regs) > show_registers(regs); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Copy the thread-specific (arch specific) info from the current > * process to the new one p > diff --git a/arch/parisc/include/asm/processor.h b/arch/parisc/include/asm/processor.h > index 4621ceb51314..a608970b249a 100644 > --- a/arch/parisc/include/asm/processor.h > +++ b/arch/parisc/include/asm/processor.h > @@ -266,9 +266,6 @@ on downward growing arches, it looks like this: > > 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); > > #define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0]) > diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c > index 7c37e09c92da..3db0e97e6c06 100644 > --- a/arch/parisc/kernel/process.c > +++ b/arch/parisc/kernel/process.c > @@ -146,10 +146,6 @@ void flush_thread(void) > */ > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Idle thread support > * > diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h > index fdfaae194ddd..92e332415d02 100644 > --- a/arch/powerpc/include/asm/processor.h > +++ b/arch/powerpc/include/asm/processor.h > @@ -75,7 +75,6 @@ extern int _chrp_type; > > struct task_struct; > 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_CKFPR(i) ckfp_state.fpr[i][TS_FPROFFSET] > diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c > index 0fbda89cd1bb..991cda25b9a9 100644 > --- a/arch/powerpc/kernel/process.c > +++ b/arch/powerpc/kernel/process.c > @@ -1655,11 +1655,6 @@ EXPORT_SYMBOL_GPL(set_thread_tidr); > > #endif /* CONFIG_PPC64 */ > > -void > -release_thread(struct task_struct *t) > -{ > -} > - > /* > * this gets called so that we can store coprocessor state into memory and > * copy the current task into the new thread. > diff --git a/arch/riscv/include/asm/processor.h b/arch/riscv/include/asm/processor.h > index 19eedd4af4cd..94a0590c6971 100644 > --- a/arch/riscv/include/asm/processor.h > +++ b/arch/riscv/include/asm/processor.h > @@ -65,11 +65,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, > extern void start_thread(struct pt_regs *regs, > 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); > > > diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h > index bd66f8e34949..c52fe651eeba 100644 > --- a/arch/s390/include/asm/processor.h > +++ b/arch/s390/include/asm/processor.h > @@ -186,9 +186,6 @@ struct pt_regs; > void show_registers(struct pt_regs *regs); > 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 */ > void guarded_storage_release(struct task_struct *tsk); > void gs_load_bc_cb(struct pt_regs *regs); > diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h > index 45240ec6b85a..27aebf1e75a2 100644 > --- a/arch/sh/include/asm/processor_32.h > +++ b/arch/sh/include/asm/processor_32.h > @@ -127,9 +127,6 @@ struct task_struct; > > 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. > */ > diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c > index a808843375e7..92b6649d4929 100644 > --- a/arch/sh/kernel/process_32.c > +++ b/arch/sh/kernel/process_32.c > @@ -84,11 +84,6 @@ void flush_thread(void) > #endif > } > > -void release_thread(struct task_struct *dead_task) > -{ > - /* do nothing */ > -} > - > asmlinkage void ret_from_fork(void); > asmlinkage void ret_from_kernel_thread(void); > > diff --git a/arch/sparc/include/asm/processor_32.h b/arch/sparc/include/asm/processor_32.h > index b26c35336b51..ba8b70ffec08 100644 > --- a/arch/sparc/include/asm/processor_32.h > +++ b/arch/sparc/include/asm/processor_32.h > @@ -80,9 +80,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc, > : "memory"); > } > > -/* Free all resources held by a thread. */ > -#define release_thread(tsk) do { } while(0) > - > unsigned long __get_wchan(struct task_struct *); > > #define task_pt_regs(tsk) ((tsk)->thread.kregs) > diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h > index 89850dff6b03..2667f35d5ea5 100644 > --- a/arch/sparc/include/asm/processor_64.h > +++ b/arch/sparc/include/asm/processor_64.h > @@ -176,9 +176,6 @@ do { \ > regs->tstate &= ~TSTATE_PEF; \ > } while (0) > > -/* Free all resources held by a thread. */ > -#define release_thread(tsk) do { } while (0) > - > unsigned long __get_wchan(struct task_struct *task); > > #define task_pt_regs(tsk) (task_thread_info(tsk)->kregs) > diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h > index d0fc1862da95..bb5f06480da9 100644 > --- a/arch/um/include/asm/processor-generic.h > +++ b/arch/um/include/asm/processor-generic.h > @@ -55,10 +55,6 @@ struct thread_struct { > .request = { 0 } \ > } > > -static inline void release_thread(struct task_struct *task) > -{ > -} > - > /* > * User space process size: 3GB (default). > */ > diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h > index 356308c73951..67c9d73b31fa 100644 > --- a/arch/x86/include/asm/processor.h > +++ b/arch/x86/include/asm/processor.h > @@ -587,9 +587,6 @@ static inline void load_sp0(unsigned long sp0) > > #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); > > /* > diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h > index 76bc63127c66..5abde43c570c 100644 > --- a/arch/xtensa/include/asm/processor.h > +++ b/arch/xtensa/include/asm/processor.h > @@ -221,9 +221,6 @@ struct thread_struct { > struct task_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); > > #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) > diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h > index 81cab4b01edc..d6c48163c6de 100644 > --- a/include/linux/sched/task.h > +++ b/include/linux/sched/task.h > @@ -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); > > +/* Free all architecture-specific resources held by a thread. */ > +void release_thread(struct task_struct *dead_task); > + > #ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT > extern int arch_task_struct_size __read_mostly; > #else > diff --git a/kernel/exit.c b/kernel/exit.c > index 80376b4ac763..30cabf933fed 100644 > --- a/kernel/exit.c > +++ b/kernel/exit.c > @@ -183,6 +183,10 @@ void put_task_struct_rcu_user(struct task_struct *task) > call_rcu(&task->rcu, delayed_put_task_struct); > } > > +void __weak release_thread(struct task_struct *dead_task) > +{ > +} > + > void release_task(struct task_struct *p) > { > struct task_struct *leader; > -- > 2.35.3 > -- Best Regards Guo Ren From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.librecores.org (lists.librecores.org [88.198.125.70]) by smtp.lore.kernel.org (Postfix) with ESMTP id B267CC3F6B0 for ; Fri, 19 Aug 2022 01:48:04 +0000 (UTC) Received: from [172.31.1.100] (localhost.localdomain [127.0.0.1]) by mail.librecores.org (Postfix) with ESMTP id 8FF8D24A46; Fri, 19 Aug 2022 03:48:03 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mail.librecores.org (Postfix) with ESMTPS id 5367824A71 for ; Fri, 19 Aug 2022 03:48:02 +0200 (CEST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 23FB361426 for ; Fri, 19 Aug 2022 01:48:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E963BC43145 for ; Fri, 19 Aug 2022 01:47:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660873680; bh=5JatSOxYSIl5vDUQiorJPobY5OCnJz2Lpd3CiqC5c7c=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=o92Wkus4Gun/HKgQhH8d0eBMVCpmCdlW8KEESP8A4DPwvdJcQNGcvNjFA0WMGs275 darUrKzPyVpYB1fULzaeeoPvRwZC8ItbGQNcwte/iRmK9uYD1NXIOfxOlXNtOCwL/3 jnXMjpcPcPion0GnZi9gme1v4y8PqThy2wpEWiceMhTD+kBPb2kPE3AKyTKBTVpyeH aB54q2Aeo2PeRHQCoNRUW0qOagpmKrdNAG1f+3S2wVgU2Nn/A5Ud4dBf9qRX/+N4nD fIedb6JAK+px5I2d9CUo9JeeNcsglTkOzb9hFHkoTFeP/RFB5wCZ/L37eGR6OLunqJ VAHl5tf34822g== Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-11cc7698a18so720592fac.4 for ; Thu, 18 Aug 2022 18:47:59 -0700 (PDT) X-Gm-Message-State: ACgBeo1Cz5WSsMLtA1bOGUerZ/6vS9/8jhAGkTkU1q95V8lS0iTdLsCm 1TCaS0WiiPzOskbI+gVHdT597xxxfQGnI0/+Re4= X-Google-Smtp-Source: AA6agR4OyqmepS4+VTsu9a8dSLWpo0jz7CjT66zOKAEPn9pWyDEV5uDKfXPjUxFtFMX/enUe8dxNMNdryyp/ovEVZgs= X-Received: by 2002:a05:6870:c596:b0:101:6409:ae62 with SMTP id ba22-20020a056870c59600b001016409ae62mr5559480oab.112.1660873668265; Thu, 18 Aug 2022 18:47:48 -0700 (PDT) MIME-Version: 1.0 References: <20220819014406.32266-1-wangkefeng.wang@huawei.com> In-Reply-To: <20220819014406.32266-1-wangkefeng.wang@huawei.com> From: Guo Ren Date: Fri, 19 Aug 2022 09:47:34 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kernel: exit: cleanup release_thread() To: Kefeng Wang Content-Type: text/plain; charset="UTF-8" X-BeenThere: openrisc@lists.librecores.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Discussion around the OpenRISC processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rich Felker , Thomas Gleixner , linux-sh@vger.kernel.org, Catalin Marinas , Dave Hansen , x86@kernel.org, linux-mips@vger.kernel.org, "James E . J . Bottomley" , Max Filippov , linux-csky@vger.kernel.org, sparclinux@vger.kernel.org, linux-hexagon@vger.kernel.org, WANG Xuerui , Will Deacon , Alexander Gordeev , Anton Ivanov , Jonas Bonn , linux-s390@vger.kernel.org, linux-ia64@vger.kernel.org, linux-snps-arc@lists.infradead.org, Yoshinori Sato , Michael Ellerman , Helge Deller , Huacai Chen , Russell King , Christophe Leroy , Ingo Molnar , Vineet Gupta , Matt Turner , Christian Borntraeger , linux-xtensa@linux-xtensa.org, Vasily Gorbik , Chris Zankel , linux-um@lists.infradead.org, Heiko Carstens , linux-alpha@vger.kernel.org, Richard Henderson , Nicholas Piggin , linux-m68k@lists.linux-m68k.org, openrisc@lists.librecores.org, Ivan Kokshaysky , loongarch@lists.linux.dev, Paul Walmsley , akpm@linux-foundation.org, linux-arm-kernel@lists.infradead.org, Brian Cain , Michal Simek , Thomas Bogendoerfer , linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, Dinh Nguyen , linux-riscv@lists.infradead.org, Palmer Dabbelt , Sven Schnelle , Richard Weinberger , Borislav Petkov , Johannes Berg , linuxppc-dev@lists.ozlabs.org, "David S . Miller" Errors-To: openrisc-bounces@lists.librecores.org Sender: "OpenRISC" For csky part Acked-by: Guo Ren On Fri, Aug 19, 2022 at 9:39 AM Kefeng Wang wrote: > > Only x86 has own release_thread(), introduce a new weak > release_thread() function to clean empty definitions in > other ARCHs. > > Signed-off-by: Kefeng Wang > --- > arch/alpha/include/asm/processor.h | 2 -- > arch/alpha/kernel/process.c | 5 ----- > arch/arc/include/asm/processor.h | 3 --- > arch/arm/include/asm/processor.h | 3 --- > arch/arm/kernel/process.c | 4 ---- > arch/arm64/include/asm/processor.h | 3 --- > arch/arm64/kernel/process.c | 4 ---- > arch/csky/include/asm/processor.h | 5 ----- > arch/hexagon/include/asm/processor.h | 4 ---- > arch/hexagon/kernel/process.c | 7 ------- > arch/ia64/include/asm/processor.h | 7 ------- > arch/loongarch/include/asm/processor.h | 3 --- > arch/m68k/include/asm/processor.h | 5 ----- > arch/microblaze/include/asm/processor.h | 5 ----- > arch/mips/include/asm/processor.h | 3 --- > arch/nios2/include/asm/processor.h | 5 ----- > arch/openrisc/include/asm/processor.h | 1 - > arch/openrisc/kernel/process.c | 4 ---- > arch/parisc/include/asm/processor.h | 3 --- > arch/parisc/kernel/process.c | 4 ---- > arch/powerpc/include/asm/processor.h | 1 - > arch/powerpc/kernel/process.c | 5 ----- > arch/riscv/include/asm/processor.h | 5 ----- > arch/s390/include/asm/processor.h | 3 --- > arch/sh/include/asm/processor_32.h | 3 --- > arch/sh/kernel/process_32.c | 5 ----- > arch/sparc/include/asm/processor_32.h | 3 --- > arch/sparc/include/asm/processor_64.h | 3 --- > arch/um/include/asm/processor-generic.h | 4 ---- > arch/x86/include/asm/processor.h | 3 --- > arch/xtensa/include/asm/processor.h | 3 --- > include/linux/sched/task.h | 3 +++ > kernel/exit.c | 4 ++++ > 33 files changed, 7 insertions(+), 118 deletions(-) > > diff --git a/arch/alpha/include/asm/processor.h b/arch/alpha/include/asm/processor.h > index 43e234c518b1..714abe494e5f 100644 > --- a/arch/alpha/include/asm/processor.h > +++ b/arch/alpha/include/asm/processor.h > @@ -36,8 +36,6 @@ extern void start_thread(struct pt_regs *, unsigned long, unsigned long); > > /* Free all resources held by a thread. */ > struct task_struct; > -extern void release_thread(struct task_struct *); > - > unsigned long __get_wchan(struct task_struct *p); > > #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) > diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c > index e2e25f8b5e76..dbf1bc5e2ad2 100644 > --- a/arch/alpha/kernel/process.c > +++ b/arch/alpha/kernel/process.c > @@ -225,11 +225,6 @@ flush_thread(void) > current_thread_info()->pcb.unique = 0; > } > > -void > -release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Copy architecture-specific thread state > */ > diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h > index 54db9d7bb562..fb844fce1ab6 100644 > --- a/arch/arc/include/asm/processor.h > +++ b/arch/arc/include/asm/processor.h > @@ -43,9 +43,6 @@ struct task_struct; > #define task_pt_regs(p) \ > ((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 > * get optimised away by gcc > diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h > index bdc35c0e8dfb..326864f79d18 100644 > --- a/arch/arm/include/asm/processor.h > +++ b/arch/arm/include/asm/processor.h > @@ -81,9 +81,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, > /* Forward declaration, a strange C thing */ > 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); > > #define task_pt_regs(p) \ > diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c > index 3d9cace63884..712d3e6d9be9 100644 > --- a/arch/arm/kernel/process.c > +++ b/arch/arm/kernel/process.c > @@ -232,10 +232,6 @@ void flush_thread(void) > thread_notify(THREAD_NOTIFY_FLUSH, thread); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); > > int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) > diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h > index 86eb0bfe3b38..4cfb4cd1d475 100644 > --- a/arch/arm64/include/asm/processor.h > +++ b/arch/arm64/include/asm/processor.h > @@ -323,9 +323,6 @@ static inline bool is_ttbr1_addr(unsigned long addr) > /* Forward declaration, a strange C thing */ > 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); > > void update_sctlr_el1(u64 sctlr); > diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c > index 92bcc1768f0b..9015f49c206e 100644 > --- a/arch/arm64/kernel/process.c > +++ b/arch/arm64/kernel/process.c > @@ -279,10 +279,6 @@ void flush_thread(void) > flush_tagged_addr_state(); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > void arch_release_task_struct(struct task_struct *tsk) > { > fpsimd_release_task(tsk); > diff --git a/arch/csky/include/asm/processor.h b/arch/csky/include/asm/processor.h > index 9638206bc44f..63ad71fab30d 100644 > --- a/arch/csky/include/asm/processor.h > +++ b/arch/csky/include/asm/processor.h > @@ -69,11 +69,6 @@ do { \ > /* Forward declaration, a strange C thing */ > 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 */ > #define prepare_to_copy(tsk) do { } while (0) > > diff --git a/arch/hexagon/include/asm/processor.h b/arch/hexagon/include/asm/processor.h > index 615f7e49968e..0cd39c2cdf8f 100644 > --- a/arch/hexagon/include/asm/processor.h > +++ b/arch/hexagon/include/asm/processor.h > @@ -60,10 +60,6 @@ struct thread_struct { > #define KSTK_EIP(tsk) (pt_elr(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); > > /* The following stuff is pretty HEXAGON specific. */ > diff --git a/arch/hexagon/kernel/process.c b/arch/hexagon/kernel/process.c > index f0552f98a7ba..e15eeaebd785 100644 > --- a/arch/hexagon/kernel/process.c > +++ b/arch/hexagon/kernel/process.c > @@ -112,13 +112,6 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) > 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 > */ > diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h > index 757c2f6d8d4b..d1978e004054 100644 > --- a/arch/ia64/include/asm/processor.h > +++ b/arch/ia64/include/asm/processor.h > @@ -318,13 +318,6 @@ struct thread_struct { > struct mm_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. */ > extern unsigned long __get_wchan (struct task_struct *p); > > diff --git a/arch/loongarch/include/asm/processor.h b/arch/loongarch/include/asm/processor.h > index 1c4b4308378d..6954dc5d24e9 100644 > --- a/arch/loongarch/include/asm/processor.h > +++ b/arch/loongarch/include/asm/processor.h > @@ -176,9 +176,6 @@ struct thread_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}; > > extern unsigned long boot_option_idle_override; > diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h > index d86b4009880b..7a2da780830b 100644 > --- a/arch/m68k/include/asm/processor.h > +++ b/arch/m68k/include/asm/processor.h > @@ -145,11 +145,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc, > /* Forward declaration, a strange C thing */ > 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); > void show_registers(struct pt_regs *regs); > > diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h > index 7e9e92670df3..4e193c7550df 100644 > --- a/arch/microblaze/include/asm/processor.h > +++ b/arch/microblaze/include/asm/processor.h > @@ -63,11 +63,6 @@ struct thread_struct { > .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); > > /* The size allocated for kernel stacks. This _must_ be a power of two! */ > diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h > index 4bb24579d12e..3fde1ff72bd1 100644 > --- a/arch/mips/include/asm/processor.h > +++ b/arch/mips/include/asm/processor.h > @@ -344,9 +344,6 @@ struct thread_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. > */ > diff --git a/arch/nios2/include/asm/processor.h b/arch/nios2/include/asm/processor.h > index b8125dfbcad2..8916d93d5c2d 100644 > --- a/arch/nios2/include/asm/processor.h > +++ b/arch/nios2/include/asm/processor.h > @@ -64,11 +64,6 @@ extern void start_thread(struct pt_regs *regs, unsigned long pc, > > 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); > > #define task_pt_regs(p) \ > diff --git a/arch/openrisc/include/asm/processor.h b/arch/openrisc/include/asm/processor.h > index aa1699c18add..ed9efb430afa 100644 > --- a/arch/openrisc/include/asm/processor.h > +++ b/arch/openrisc/include/asm/processor.h > @@ -72,7 +72,6 @@ struct thread_struct { > > > 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); > > #define cpu_relax() barrier() > diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c > index 52dc983ddeba..f94b5ec06786 100644 > --- a/arch/openrisc/kernel/process.c > +++ b/arch/openrisc/kernel/process.c > @@ -125,10 +125,6 @@ void show_regs(struct pt_regs *regs) > show_registers(regs); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Copy the thread-specific (arch specific) info from the current > * process to the new one p > diff --git a/arch/parisc/include/asm/processor.h b/arch/parisc/include/asm/processor.h > index 4621ceb51314..a608970b249a 100644 > --- a/arch/parisc/include/asm/processor.h > +++ b/arch/parisc/include/asm/processor.h > @@ -266,9 +266,6 @@ on downward growing arches, it looks like this: > > 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); > > #define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0]) > diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c > index 7c37e09c92da..3db0e97e6c06 100644 > --- a/arch/parisc/kernel/process.c > +++ b/arch/parisc/kernel/process.c > @@ -146,10 +146,6 @@ void flush_thread(void) > */ > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Idle thread support > * > diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h > index fdfaae194ddd..92e332415d02 100644 > --- a/arch/powerpc/include/asm/processor.h > +++ b/arch/powerpc/include/asm/processor.h > @@ -75,7 +75,6 @@ extern int _chrp_type; > > struct task_struct; > 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_CKFPR(i) ckfp_state.fpr[i][TS_FPROFFSET] > diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c > index 0fbda89cd1bb..991cda25b9a9 100644 > --- a/arch/powerpc/kernel/process.c > +++ b/arch/powerpc/kernel/process.c > @@ -1655,11 +1655,6 @@ EXPORT_SYMBOL_GPL(set_thread_tidr); > > #endif /* CONFIG_PPC64 */ > > -void > -release_thread(struct task_struct *t) > -{ > -} > - > /* > * this gets called so that we can store coprocessor state into memory and > * copy the current task into the new thread. > diff --git a/arch/riscv/include/asm/processor.h b/arch/riscv/include/asm/processor.h > index 19eedd4af4cd..94a0590c6971 100644 > --- a/arch/riscv/include/asm/processor.h > +++ b/arch/riscv/include/asm/processor.h > @@ -65,11 +65,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, > extern void start_thread(struct pt_regs *regs, > 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); > > > diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h > index bd66f8e34949..c52fe651eeba 100644 > --- a/arch/s390/include/asm/processor.h > +++ b/arch/s390/include/asm/processor.h > @@ -186,9 +186,6 @@ struct pt_regs; > void show_registers(struct pt_regs *regs); > 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 */ > void guarded_storage_release(struct task_struct *tsk); > void gs_load_bc_cb(struct pt_regs *regs); > diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h > index 45240ec6b85a..27aebf1e75a2 100644 > --- a/arch/sh/include/asm/processor_32.h > +++ b/arch/sh/include/asm/processor_32.h > @@ -127,9 +127,6 @@ struct task_struct; > > 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. > */ > diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c > index a808843375e7..92b6649d4929 100644 > --- a/arch/sh/kernel/process_32.c > +++ b/arch/sh/kernel/process_32.c > @@ -84,11 +84,6 @@ void flush_thread(void) > #endif > } > > -void release_thread(struct task_struct *dead_task) > -{ > - /* do nothing */ > -} > - > asmlinkage void ret_from_fork(void); > asmlinkage void ret_from_kernel_thread(void); > > diff --git a/arch/sparc/include/asm/processor_32.h b/arch/sparc/include/asm/processor_32.h > index b26c35336b51..ba8b70ffec08 100644 > --- a/arch/sparc/include/asm/processor_32.h > +++ b/arch/sparc/include/asm/processor_32.h > @@ -80,9 +80,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc, > : "memory"); > } > > -/* Free all resources held by a thread. */ > -#define release_thread(tsk) do { } while(0) > - > unsigned long __get_wchan(struct task_struct *); > > #define task_pt_regs(tsk) ((tsk)->thread.kregs) > diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h > index 89850dff6b03..2667f35d5ea5 100644 > --- a/arch/sparc/include/asm/processor_64.h > +++ b/arch/sparc/include/asm/processor_64.h > @@ -176,9 +176,6 @@ do { \ > regs->tstate &= ~TSTATE_PEF; \ > } while (0) > > -/* Free all resources held by a thread. */ > -#define release_thread(tsk) do { } while (0) > - > unsigned long __get_wchan(struct task_struct *task); > > #define task_pt_regs(tsk) (task_thread_info(tsk)->kregs) > diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h > index d0fc1862da95..bb5f06480da9 100644 > --- a/arch/um/include/asm/processor-generic.h > +++ b/arch/um/include/asm/processor-generic.h > @@ -55,10 +55,6 @@ struct thread_struct { > .request = { 0 } \ > } > > -static inline void release_thread(struct task_struct *task) > -{ > -} > - > /* > * User space process size: 3GB (default). > */ > diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h > index 356308c73951..67c9d73b31fa 100644 > --- a/arch/x86/include/asm/processor.h > +++ b/arch/x86/include/asm/processor.h > @@ -587,9 +587,6 @@ static inline void load_sp0(unsigned long sp0) > > #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); > > /* > diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h > index 76bc63127c66..5abde43c570c 100644 > --- a/arch/xtensa/include/asm/processor.h > +++ b/arch/xtensa/include/asm/processor.h > @@ -221,9 +221,6 @@ struct thread_struct { > struct task_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); > > #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) > diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h > index 81cab4b01edc..d6c48163c6de 100644 > --- a/include/linux/sched/task.h > +++ b/include/linux/sched/task.h > @@ -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); > > +/* Free all architecture-specific resources held by a thread. */ > +void release_thread(struct task_struct *dead_task); > + > #ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT > extern int arch_task_struct_size __read_mostly; > #else > diff --git a/kernel/exit.c b/kernel/exit.c > index 80376b4ac763..30cabf933fed 100644 > --- a/kernel/exit.c > +++ b/kernel/exit.c > @@ -183,6 +183,10 @@ void put_task_struct_rcu_user(struct task_struct *task) > call_rcu(&task->rcu, delayed_put_task_struct); > } > > +void __weak release_thread(struct task_struct *dead_task) > +{ > +} > + > void release_task(struct task_struct *p) > { > struct task_struct *leader; > -- > 2.35.3 > -- Best Regards Guo Ren From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E1530C00140 for ; Fri, 19 Aug 2022 01:48:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1Jvj0uMOc86MWvWWpTs0ei5fqmBQVc58lULIlUfRpf4=; b=K/i4hH6Vl7ih0+ 0mGdLkEOIdkRwHW0cVaP+13BDeegUd4rNiP0aPYZ+mthycUFcY+wf8jfhDrl+4v2ovjeopSlFxski Q8O9I86p0jUsN4uEn+He6rXE6Y7rVNZQbIBqs0aYuwS2qsPmEWuqYdwzupnQJnwLOdmunWMgsfgyV lf+zyyLL51jCu7+wBDD1b5IrvE8BZxRWKvoe2g355nYcK7MlbOVwMM6Izy5VehsWFUlTqjk2BFFbj zQ+U1aWIvkE96r5mevTd2u8v9n0fWxjeoOoLfZOezLrdHYQGKmpaO5HM/8toZRMG8bAyYR1R01mPz QJasIzcILy7LCTzKM65Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOr7I-00DcoG-5v; Fri, 19 Aug 2022 01:48:08 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOr7C-00DclY-EH; Fri, 19 Aug 2022 01:48:05 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B8A7E6143D; Fri, 19 Aug 2022 01:48:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45146C4314A; Fri, 19 Aug 2022 01:48:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660873680; bh=5JatSOxYSIl5vDUQiorJPobY5OCnJz2Lpd3CiqC5c7c=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=o92Wkus4Gun/HKgQhH8d0eBMVCpmCdlW8KEESP8A4DPwvdJcQNGcvNjFA0WMGs275 darUrKzPyVpYB1fULzaeeoPvRwZC8ItbGQNcwte/iRmK9uYD1NXIOfxOlXNtOCwL/3 jnXMjpcPcPion0GnZi9gme1v4y8PqThy2wpEWiceMhTD+kBPb2kPE3AKyTKBTVpyeH aB54q2Aeo2PeRHQCoNRUW0qOagpmKrdNAG1f+3S2wVgU2Nn/A5Ud4dBf9qRX/+N4nD fIedb6JAK+px5I2d9CUo9JeeNcsglTkOzb9hFHkoTFeP/RFB5wCZ/L37eGR6OLunqJ VAHl5tf34822g== Received: by mail-oa1-f53.google.com with SMTP id 586e51a60fabf-11c4d7d4683so3756421fac.8; Thu, 18 Aug 2022 18:48:00 -0700 (PDT) X-Gm-Message-State: ACgBeo2YM0VqDv67NM5RVL5+c3dL4k3K953FFJuppqwD8xRdM3uTL8s3 TH4Hf6ewByMwK/g8OYJg6rypzoJtDIwjkVaIj3w= X-Google-Smtp-Source: AA6agR4OyqmepS4+VTsu9a8dSLWpo0jz7CjT66zOKAEPn9pWyDEV5uDKfXPjUxFtFMX/enUe8dxNMNdryyp/ovEVZgs= X-Received: by 2002:a05:6870:c596:b0:101:6409:ae62 with SMTP id ba22-20020a056870c59600b001016409ae62mr5559480oab.112.1660873668265; Thu, 18 Aug 2022 18:47:48 -0700 (PDT) MIME-Version: 1.0 References: <20220819014406.32266-1-wangkefeng.wang@huawei.com> In-Reply-To: <20220819014406.32266-1-wangkefeng.wang@huawei.com> From: Guo Ren Date: Fri, 19 Aug 2022 09:47:34 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kernel: exit: cleanup release_thread() To: Kefeng Wang Cc: Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Catalin Marinas , Will Deacon , Brian Cain , Huacai Chen , WANG Xuerui , Geert Uytterhoeven , Michal Simek , Thomas Bogendoerfer , Dinh Nguyen , Jonas Bonn , Stefan Kristiansson , Stafford Horne , "James E . J . Bottomley" , Helge Deller , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Paul Walmsley , Palmer Dabbelt , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Yoshinori Sato , Rich Felker , "David S . Miller" , Richard Weinberger , Anton Ivanov , Johannes Berg , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Chris Zankel , Max Filippov , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, linux-xtensa@linux-xtensa.org, akpm@linux-foundation.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220818_184802_619127_86C0B389 X-CRM114-Status: GOOD ( 25.91 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org For csky part Acked-by: Guo Ren On Fri, Aug 19, 2022 at 9:39 AM Kefeng Wang wrote: > > Only x86 has own release_thread(), introduce a new weak > release_thread() function to clean empty definitions in > other ARCHs. > > Signed-off-by: Kefeng Wang > --- > arch/alpha/include/asm/processor.h | 2 -- > arch/alpha/kernel/process.c | 5 ----- > arch/arc/include/asm/processor.h | 3 --- > arch/arm/include/asm/processor.h | 3 --- > arch/arm/kernel/process.c | 4 ---- > arch/arm64/include/asm/processor.h | 3 --- > arch/arm64/kernel/process.c | 4 ---- > arch/csky/include/asm/processor.h | 5 ----- > arch/hexagon/include/asm/processor.h | 4 ---- > arch/hexagon/kernel/process.c | 7 ------- > arch/ia64/include/asm/processor.h | 7 ------- > arch/loongarch/include/asm/processor.h | 3 --- > arch/m68k/include/asm/processor.h | 5 ----- > arch/microblaze/include/asm/processor.h | 5 ----- > arch/mips/include/asm/processor.h | 3 --- > arch/nios2/include/asm/processor.h | 5 ----- > arch/openrisc/include/asm/processor.h | 1 - > arch/openrisc/kernel/process.c | 4 ---- > arch/parisc/include/asm/processor.h | 3 --- > arch/parisc/kernel/process.c | 4 ---- > arch/powerpc/include/asm/processor.h | 1 - > arch/powerpc/kernel/process.c | 5 ----- > arch/riscv/include/asm/processor.h | 5 ----- > arch/s390/include/asm/processor.h | 3 --- > arch/sh/include/asm/processor_32.h | 3 --- > arch/sh/kernel/process_32.c | 5 ----- > arch/sparc/include/asm/processor_32.h | 3 --- > arch/sparc/include/asm/processor_64.h | 3 --- > arch/um/include/asm/processor-generic.h | 4 ---- > arch/x86/include/asm/processor.h | 3 --- > arch/xtensa/include/asm/processor.h | 3 --- > include/linux/sched/task.h | 3 +++ > kernel/exit.c | 4 ++++ > 33 files changed, 7 insertions(+), 118 deletions(-) > > diff --git a/arch/alpha/include/asm/processor.h b/arch/alpha/include/asm/processor.h > index 43e234c518b1..714abe494e5f 100644 > --- a/arch/alpha/include/asm/processor.h > +++ b/arch/alpha/include/asm/processor.h > @@ -36,8 +36,6 @@ extern void start_thread(struct pt_regs *, unsigned long, unsigned long); > > /* Free all resources held by a thread. */ > struct task_struct; > -extern void release_thread(struct task_struct *); > - > unsigned long __get_wchan(struct task_struct *p); > > #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) > diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c > index e2e25f8b5e76..dbf1bc5e2ad2 100644 > --- a/arch/alpha/kernel/process.c > +++ b/arch/alpha/kernel/process.c > @@ -225,11 +225,6 @@ flush_thread(void) > current_thread_info()->pcb.unique = 0; > } > > -void > -release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Copy architecture-specific thread state > */ > diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h > index 54db9d7bb562..fb844fce1ab6 100644 > --- a/arch/arc/include/asm/processor.h > +++ b/arch/arc/include/asm/processor.h > @@ -43,9 +43,6 @@ struct task_struct; > #define task_pt_regs(p) \ > ((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 > * get optimised away by gcc > diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h > index bdc35c0e8dfb..326864f79d18 100644 > --- a/arch/arm/include/asm/processor.h > +++ b/arch/arm/include/asm/processor.h > @@ -81,9 +81,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, > /* Forward declaration, a strange C thing */ > 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); > > #define task_pt_regs(p) \ > diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c > index 3d9cace63884..712d3e6d9be9 100644 > --- a/arch/arm/kernel/process.c > +++ b/arch/arm/kernel/process.c > @@ -232,10 +232,6 @@ void flush_thread(void) > thread_notify(THREAD_NOTIFY_FLUSH, thread); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); > > int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) > diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h > index 86eb0bfe3b38..4cfb4cd1d475 100644 > --- a/arch/arm64/include/asm/processor.h > +++ b/arch/arm64/include/asm/processor.h > @@ -323,9 +323,6 @@ static inline bool is_ttbr1_addr(unsigned long addr) > /* Forward declaration, a strange C thing */ > 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); > > void update_sctlr_el1(u64 sctlr); > diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c > index 92bcc1768f0b..9015f49c206e 100644 > --- a/arch/arm64/kernel/process.c > +++ b/arch/arm64/kernel/process.c > @@ -279,10 +279,6 @@ void flush_thread(void) > flush_tagged_addr_state(); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > void arch_release_task_struct(struct task_struct *tsk) > { > fpsimd_release_task(tsk); > diff --git a/arch/csky/include/asm/processor.h b/arch/csky/include/asm/processor.h > index 9638206bc44f..63ad71fab30d 100644 > --- a/arch/csky/include/asm/processor.h > +++ b/arch/csky/include/asm/processor.h > @@ -69,11 +69,6 @@ do { \ > /* Forward declaration, a strange C thing */ > 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 */ > #define prepare_to_copy(tsk) do { } while (0) > > diff --git a/arch/hexagon/include/asm/processor.h b/arch/hexagon/include/asm/processor.h > index 615f7e49968e..0cd39c2cdf8f 100644 > --- a/arch/hexagon/include/asm/processor.h > +++ b/arch/hexagon/include/asm/processor.h > @@ -60,10 +60,6 @@ struct thread_struct { > #define KSTK_EIP(tsk) (pt_elr(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); > > /* The following stuff is pretty HEXAGON specific. */ > diff --git a/arch/hexagon/kernel/process.c b/arch/hexagon/kernel/process.c > index f0552f98a7ba..e15eeaebd785 100644 > --- a/arch/hexagon/kernel/process.c > +++ b/arch/hexagon/kernel/process.c > @@ -112,13 +112,6 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) > 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 > */ > diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h > index 757c2f6d8d4b..d1978e004054 100644 > --- a/arch/ia64/include/asm/processor.h > +++ b/arch/ia64/include/asm/processor.h > @@ -318,13 +318,6 @@ struct thread_struct { > struct mm_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. */ > extern unsigned long __get_wchan (struct task_struct *p); > > diff --git a/arch/loongarch/include/asm/processor.h b/arch/loongarch/include/asm/processor.h > index 1c4b4308378d..6954dc5d24e9 100644 > --- a/arch/loongarch/include/asm/processor.h > +++ b/arch/loongarch/include/asm/processor.h > @@ -176,9 +176,6 @@ struct thread_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}; > > extern unsigned long boot_option_idle_override; > diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h > index d86b4009880b..7a2da780830b 100644 > --- a/arch/m68k/include/asm/processor.h > +++ b/arch/m68k/include/asm/processor.h > @@ -145,11 +145,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc, > /* Forward declaration, a strange C thing */ > 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); > void show_registers(struct pt_regs *regs); > > diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h > index 7e9e92670df3..4e193c7550df 100644 > --- a/arch/microblaze/include/asm/processor.h > +++ b/arch/microblaze/include/asm/processor.h > @@ -63,11 +63,6 @@ struct thread_struct { > .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); > > /* The size allocated for kernel stacks. This _must_ be a power of two! */ > diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h > index 4bb24579d12e..3fde1ff72bd1 100644 > --- a/arch/mips/include/asm/processor.h > +++ b/arch/mips/include/asm/processor.h > @@ -344,9 +344,6 @@ struct thread_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. > */ > diff --git a/arch/nios2/include/asm/processor.h b/arch/nios2/include/asm/processor.h > index b8125dfbcad2..8916d93d5c2d 100644 > --- a/arch/nios2/include/asm/processor.h > +++ b/arch/nios2/include/asm/processor.h > @@ -64,11 +64,6 @@ extern void start_thread(struct pt_regs *regs, unsigned long pc, > > 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); > > #define task_pt_regs(p) \ > diff --git a/arch/openrisc/include/asm/processor.h b/arch/openrisc/include/asm/processor.h > index aa1699c18add..ed9efb430afa 100644 > --- a/arch/openrisc/include/asm/processor.h > +++ b/arch/openrisc/include/asm/processor.h > @@ -72,7 +72,6 @@ struct thread_struct { > > > 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); > > #define cpu_relax() barrier() > diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c > index 52dc983ddeba..f94b5ec06786 100644 > --- a/arch/openrisc/kernel/process.c > +++ b/arch/openrisc/kernel/process.c > @@ -125,10 +125,6 @@ void show_regs(struct pt_regs *regs) > show_registers(regs); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Copy the thread-specific (arch specific) info from the current > * process to the new one p > diff --git a/arch/parisc/include/asm/processor.h b/arch/parisc/include/asm/processor.h > index 4621ceb51314..a608970b249a 100644 > --- a/arch/parisc/include/asm/processor.h > +++ b/arch/parisc/include/asm/processor.h > @@ -266,9 +266,6 @@ on downward growing arches, it looks like this: > > 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); > > #define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0]) > diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c > index 7c37e09c92da..3db0e97e6c06 100644 > --- a/arch/parisc/kernel/process.c > +++ b/arch/parisc/kernel/process.c > @@ -146,10 +146,6 @@ void flush_thread(void) > */ > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Idle thread support > * > diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h > index fdfaae194ddd..92e332415d02 100644 > --- a/arch/powerpc/include/asm/processor.h > +++ b/arch/powerpc/include/asm/processor.h > @@ -75,7 +75,6 @@ extern int _chrp_type; > > struct task_struct; > 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_CKFPR(i) ckfp_state.fpr[i][TS_FPROFFSET] > diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c > index 0fbda89cd1bb..991cda25b9a9 100644 > --- a/arch/powerpc/kernel/process.c > +++ b/arch/powerpc/kernel/process.c > @@ -1655,11 +1655,6 @@ EXPORT_SYMBOL_GPL(set_thread_tidr); > > #endif /* CONFIG_PPC64 */ > > -void > -release_thread(struct task_struct *t) > -{ > -} > - > /* > * this gets called so that we can store coprocessor state into memory and > * copy the current task into the new thread. > diff --git a/arch/riscv/include/asm/processor.h b/arch/riscv/include/asm/processor.h > index 19eedd4af4cd..94a0590c6971 100644 > --- a/arch/riscv/include/asm/processor.h > +++ b/arch/riscv/include/asm/processor.h > @@ -65,11 +65,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, > extern void start_thread(struct pt_regs *regs, > 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); > > > diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h > index bd66f8e34949..c52fe651eeba 100644 > --- a/arch/s390/include/asm/processor.h > +++ b/arch/s390/include/asm/processor.h > @@ -186,9 +186,6 @@ struct pt_regs; > void show_registers(struct pt_regs *regs); > 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 */ > void guarded_storage_release(struct task_struct *tsk); > void gs_load_bc_cb(struct pt_regs *regs); > diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h > index 45240ec6b85a..27aebf1e75a2 100644 > --- a/arch/sh/include/asm/processor_32.h > +++ b/arch/sh/include/asm/processor_32.h > @@ -127,9 +127,6 @@ struct task_struct; > > 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. > */ > diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c > index a808843375e7..92b6649d4929 100644 > --- a/arch/sh/kernel/process_32.c > +++ b/arch/sh/kernel/process_32.c > @@ -84,11 +84,6 @@ void flush_thread(void) > #endif > } > > -void release_thread(struct task_struct *dead_task) > -{ > - /* do nothing */ > -} > - > asmlinkage void ret_from_fork(void); > asmlinkage void ret_from_kernel_thread(void); > > diff --git a/arch/sparc/include/asm/processor_32.h b/arch/sparc/include/asm/processor_32.h > index b26c35336b51..ba8b70ffec08 100644 > --- a/arch/sparc/include/asm/processor_32.h > +++ b/arch/sparc/include/asm/processor_32.h > @@ -80,9 +80,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc, > : "memory"); > } > > -/* Free all resources held by a thread. */ > -#define release_thread(tsk) do { } while(0) > - > unsigned long __get_wchan(struct task_struct *); > > #define task_pt_regs(tsk) ((tsk)->thread.kregs) > diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h > index 89850dff6b03..2667f35d5ea5 100644 > --- a/arch/sparc/include/asm/processor_64.h > +++ b/arch/sparc/include/asm/processor_64.h > @@ -176,9 +176,6 @@ do { \ > regs->tstate &= ~TSTATE_PEF; \ > } while (0) > > -/* Free all resources held by a thread. */ > -#define release_thread(tsk) do { } while (0) > - > unsigned long __get_wchan(struct task_struct *task); > > #define task_pt_regs(tsk) (task_thread_info(tsk)->kregs) > diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h > index d0fc1862da95..bb5f06480da9 100644 > --- a/arch/um/include/asm/processor-generic.h > +++ b/arch/um/include/asm/processor-generic.h > @@ -55,10 +55,6 @@ struct thread_struct { > .request = { 0 } \ > } > > -static inline void release_thread(struct task_struct *task) > -{ > -} > - > /* > * User space process size: 3GB (default). > */ > diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h > index 356308c73951..67c9d73b31fa 100644 > --- a/arch/x86/include/asm/processor.h > +++ b/arch/x86/include/asm/processor.h > @@ -587,9 +587,6 @@ static inline void load_sp0(unsigned long sp0) > > #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); > > /* > diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h > index 76bc63127c66..5abde43c570c 100644 > --- a/arch/xtensa/include/asm/processor.h > +++ b/arch/xtensa/include/asm/processor.h > @@ -221,9 +221,6 @@ struct thread_struct { > struct task_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); > > #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) > diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h > index 81cab4b01edc..d6c48163c6de 100644 > --- a/include/linux/sched/task.h > +++ b/include/linux/sched/task.h > @@ -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); > > +/* Free all architecture-specific resources held by a thread. */ > +void release_thread(struct task_struct *dead_task); > + > #ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT > extern int arch_task_struct_size __read_mostly; > #else > diff --git a/kernel/exit.c b/kernel/exit.c > index 80376b4ac763..30cabf933fed 100644 > --- a/kernel/exit.c > +++ b/kernel/exit.c > @@ -183,6 +183,10 @@ void put_task_struct_rcu_user(struct task_struct *task) > call_rcu(&task->rcu, delayed_put_task_struct); > } > > +void __weak release_thread(struct task_struct *dead_task) > +{ > +} > + > void release_task(struct task_struct *p) > { > struct task_struct *leader; > -- > 2.35.3 > -- Best Regards Guo Ren _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CBCDCC25B0E for ; Fri, 19 Aug 2022 01:48:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VitN0oBz6B8M0U5WsrTvZCc4hNRnGQPdP1wumsKEsPU=; b=EM6Xm2Yi3eSuKw IcES8S5aGaETJ0wgRRUqxHEm9sUHYd7n6YaI6/6ECi/oHr+y82XE0xyullXKND8brNmFEFQ54Kezi ijzDMYH5Z+ZHzb+ZLeq9Hc+YZ6rnRCyEdNZNER73mCYsG5Dw+1UL/Cz7sW8B9EtEKzMAQxrOum336 zUCjAgwY9M0IhJLmjmW5DC5vAVcvgWZHOHrLjP/wkIJQ22JBViqa5PyH4aNgC4dUets9ZTPCr+W03 0iwot7wddIwUYk7yqpd4ALkmccdNjUksoBYqD8EjXkMDHgF88d+7e5jtVsyMlpkT0iEjvJ8xYPRDC cguu9CkJ6uTnGyuU668Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOr7J-00DcpB-KL; Fri, 19 Aug 2022 01:48:09 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOr7C-00DclY-EH; Fri, 19 Aug 2022 01:48:05 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B8A7E6143D; Fri, 19 Aug 2022 01:48:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45146C4314A; Fri, 19 Aug 2022 01:48:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660873680; bh=5JatSOxYSIl5vDUQiorJPobY5OCnJz2Lpd3CiqC5c7c=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=o92Wkus4Gun/HKgQhH8d0eBMVCpmCdlW8KEESP8A4DPwvdJcQNGcvNjFA0WMGs275 darUrKzPyVpYB1fULzaeeoPvRwZC8ItbGQNcwte/iRmK9uYD1NXIOfxOlXNtOCwL/3 jnXMjpcPcPion0GnZi9gme1v4y8PqThy2wpEWiceMhTD+kBPb2kPE3AKyTKBTVpyeH aB54q2Aeo2PeRHQCoNRUW0qOagpmKrdNAG1f+3S2wVgU2Nn/A5Ud4dBf9qRX/+N4nD fIedb6JAK+px5I2d9CUo9JeeNcsglTkOzb9hFHkoTFeP/RFB5wCZ/L37eGR6OLunqJ VAHl5tf34822g== Received: by mail-oa1-f53.google.com with SMTP id 586e51a60fabf-11c4d7d4683so3756421fac.8; Thu, 18 Aug 2022 18:48:00 -0700 (PDT) X-Gm-Message-State: ACgBeo2YM0VqDv67NM5RVL5+c3dL4k3K953FFJuppqwD8xRdM3uTL8s3 TH4Hf6ewByMwK/g8OYJg6rypzoJtDIwjkVaIj3w= X-Google-Smtp-Source: AA6agR4OyqmepS4+VTsu9a8dSLWpo0jz7CjT66zOKAEPn9pWyDEV5uDKfXPjUxFtFMX/enUe8dxNMNdryyp/ovEVZgs= X-Received: by 2002:a05:6870:c596:b0:101:6409:ae62 with SMTP id ba22-20020a056870c59600b001016409ae62mr5559480oab.112.1660873668265; Thu, 18 Aug 2022 18:47:48 -0700 (PDT) MIME-Version: 1.0 References: <20220819014406.32266-1-wangkefeng.wang@huawei.com> In-Reply-To: <20220819014406.32266-1-wangkefeng.wang@huawei.com> From: Guo Ren Date: Fri, 19 Aug 2022 09:47:34 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kernel: exit: cleanup release_thread() To: Kefeng Wang Cc: Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Catalin Marinas , Will Deacon , Brian Cain , Huacai Chen , WANG Xuerui , Geert Uytterhoeven , Michal Simek , Thomas Bogendoerfer , Dinh Nguyen , Jonas Bonn , Stefan Kristiansson , Stafford Horne , "James E . J . Bottomley" , Helge Deller , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Paul Walmsley , Palmer Dabbelt , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Yoshinori Sato , Rich Felker , "David S . Miller" , Richard Weinberger , Anton Ivanov , Johannes Berg , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Chris Zankel , Max Filippov , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, linux-xtensa@linux-xtensa.org, akpm@linux-foundation.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220818_184802_619127_86C0B389 X-CRM114-Status: GOOD ( 25.91 ) X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+linux-snps-arc=archiver.kernel.org@lists.infradead.org For csky part Acked-by: Guo Ren On Fri, Aug 19, 2022 at 9:39 AM Kefeng Wang wrote: > > Only x86 has own release_thread(), introduce a new weak > release_thread() function to clean empty definitions in > other ARCHs. > > Signed-off-by: Kefeng Wang > --- > arch/alpha/include/asm/processor.h | 2 -- > arch/alpha/kernel/process.c | 5 ----- > arch/arc/include/asm/processor.h | 3 --- > arch/arm/include/asm/processor.h | 3 --- > arch/arm/kernel/process.c | 4 ---- > arch/arm64/include/asm/processor.h | 3 --- > arch/arm64/kernel/process.c | 4 ---- > arch/csky/include/asm/processor.h | 5 ----- > arch/hexagon/include/asm/processor.h | 4 ---- > arch/hexagon/kernel/process.c | 7 ------- > arch/ia64/include/asm/processor.h | 7 ------- > arch/loongarch/include/asm/processor.h | 3 --- > arch/m68k/include/asm/processor.h | 5 ----- > arch/microblaze/include/asm/processor.h | 5 ----- > arch/mips/include/asm/processor.h | 3 --- > arch/nios2/include/asm/processor.h | 5 ----- > arch/openrisc/include/asm/processor.h | 1 - > arch/openrisc/kernel/process.c | 4 ---- > arch/parisc/include/asm/processor.h | 3 --- > arch/parisc/kernel/process.c | 4 ---- > arch/powerpc/include/asm/processor.h | 1 - > arch/powerpc/kernel/process.c | 5 ----- > arch/riscv/include/asm/processor.h | 5 ----- > arch/s390/include/asm/processor.h | 3 --- > arch/sh/include/asm/processor_32.h | 3 --- > arch/sh/kernel/process_32.c | 5 ----- > arch/sparc/include/asm/processor_32.h | 3 --- > arch/sparc/include/asm/processor_64.h | 3 --- > arch/um/include/asm/processor-generic.h | 4 ---- > arch/x86/include/asm/processor.h | 3 --- > arch/xtensa/include/asm/processor.h | 3 --- > include/linux/sched/task.h | 3 +++ > kernel/exit.c | 4 ++++ > 33 files changed, 7 insertions(+), 118 deletions(-) > > diff --git a/arch/alpha/include/asm/processor.h b/arch/alpha/include/asm/processor.h > index 43e234c518b1..714abe494e5f 100644 > --- a/arch/alpha/include/asm/processor.h > +++ b/arch/alpha/include/asm/processor.h > @@ -36,8 +36,6 @@ extern void start_thread(struct pt_regs *, unsigned long, unsigned long); > > /* Free all resources held by a thread. */ > struct task_struct; > -extern void release_thread(struct task_struct *); > - > unsigned long __get_wchan(struct task_struct *p); > > #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) > diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c > index e2e25f8b5e76..dbf1bc5e2ad2 100644 > --- a/arch/alpha/kernel/process.c > +++ b/arch/alpha/kernel/process.c > @@ -225,11 +225,6 @@ flush_thread(void) > current_thread_info()->pcb.unique = 0; > } > > -void > -release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Copy architecture-specific thread state > */ > diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h > index 54db9d7bb562..fb844fce1ab6 100644 > --- a/arch/arc/include/asm/processor.h > +++ b/arch/arc/include/asm/processor.h > @@ -43,9 +43,6 @@ struct task_struct; > #define task_pt_regs(p) \ > ((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 > * get optimised away by gcc > diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h > index bdc35c0e8dfb..326864f79d18 100644 > --- a/arch/arm/include/asm/processor.h > +++ b/arch/arm/include/asm/processor.h > @@ -81,9 +81,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, > /* Forward declaration, a strange C thing */ > 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); > > #define task_pt_regs(p) \ > diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c > index 3d9cace63884..712d3e6d9be9 100644 > --- a/arch/arm/kernel/process.c > +++ b/arch/arm/kernel/process.c > @@ -232,10 +232,6 @@ void flush_thread(void) > thread_notify(THREAD_NOTIFY_FLUSH, thread); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); > > int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) > diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h > index 86eb0bfe3b38..4cfb4cd1d475 100644 > --- a/arch/arm64/include/asm/processor.h > +++ b/arch/arm64/include/asm/processor.h > @@ -323,9 +323,6 @@ static inline bool is_ttbr1_addr(unsigned long addr) > /* Forward declaration, a strange C thing */ > 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); > > void update_sctlr_el1(u64 sctlr); > diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c > index 92bcc1768f0b..9015f49c206e 100644 > --- a/arch/arm64/kernel/process.c > +++ b/arch/arm64/kernel/process.c > @@ -279,10 +279,6 @@ void flush_thread(void) > flush_tagged_addr_state(); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > void arch_release_task_struct(struct task_struct *tsk) > { > fpsimd_release_task(tsk); > diff --git a/arch/csky/include/asm/processor.h b/arch/csky/include/asm/processor.h > index 9638206bc44f..63ad71fab30d 100644 > --- a/arch/csky/include/asm/processor.h > +++ b/arch/csky/include/asm/processor.h > @@ -69,11 +69,6 @@ do { \ > /* Forward declaration, a strange C thing */ > 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 */ > #define prepare_to_copy(tsk) do { } while (0) > > diff --git a/arch/hexagon/include/asm/processor.h b/arch/hexagon/include/asm/processor.h > index 615f7e49968e..0cd39c2cdf8f 100644 > --- a/arch/hexagon/include/asm/processor.h > +++ b/arch/hexagon/include/asm/processor.h > @@ -60,10 +60,6 @@ struct thread_struct { > #define KSTK_EIP(tsk) (pt_elr(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); > > /* The following stuff is pretty HEXAGON specific. */ > diff --git a/arch/hexagon/kernel/process.c b/arch/hexagon/kernel/process.c > index f0552f98a7ba..e15eeaebd785 100644 > --- a/arch/hexagon/kernel/process.c > +++ b/arch/hexagon/kernel/process.c > @@ -112,13 +112,6 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) > 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 > */ > diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h > index 757c2f6d8d4b..d1978e004054 100644 > --- a/arch/ia64/include/asm/processor.h > +++ b/arch/ia64/include/asm/processor.h > @@ -318,13 +318,6 @@ struct thread_struct { > struct mm_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. */ > extern unsigned long __get_wchan (struct task_struct *p); > > diff --git a/arch/loongarch/include/asm/processor.h b/arch/loongarch/include/asm/processor.h > index 1c4b4308378d..6954dc5d24e9 100644 > --- a/arch/loongarch/include/asm/processor.h > +++ b/arch/loongarch/include/asm/processor.h > @@ -176,9 +176,6 @@ struct thread_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}; > > extern unsigned long boot_option_idle_override; > diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h > index d86b4009880b..7a2da780830b 100644 > --- a/arch/m68k/include/asm/processor.h > +++ b/arch/m68k/include/asm/processor.h > @@ -145,11 +145,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc, > /* Forward declaration, a strange C thing */ > 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); > void show_registers(struct pt_regs *regs); > > diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h > index 7e9e92670df3..4e193c7550df 100644 > --- a/arch/microblaze/include/asm/processor.h > +++ b/arch/microblaze/include/asm/processor.h > @@ -63,11 +63,6 @@ struct thread_struct { > .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); > > /* The size allocated for kernel stacks. This _must_ be a power of two! */ > diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h > index 4bb24579d12e..3fde1ff72bd1 100644 > --- a/arch/mips/include/asm/processor.h > +++ b/arch/mips/include/asm/processor.h > @@ -344,9 +344,6 @@ struct thread_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. > */ > diff --git a/arch/nios2/include/asm/processor.h b/arch/nios2/include/asm/processor.h > index b8125dfbcad2..8916d93d5c2d 100644 > --- a/arch/nios2/include/asm/processor.h > +++ b/arch/nios2/include/asm/processor.h > @@ -64,11 +64,6 @@ extern void start_thread(struct pt_regs *regs, unsigned long pc, > > 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); > > #define task_pt_regs(p) \ > diff --git a/arch/openrisc/include/asm/processor.h b/arch/openrisc/include/asm/processor.h > index aa1699c18add..ed9efb430afa 100644 > --- a/arch/openrisc/include/asm/processor.h > +++ b/arch/openrisc/include/asm/processor.h > @@ -72,7 +72,6 @@ struct thread_struct { > > > 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); > > #define cpu_relax() barrier() > diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c > index 52dc983ddeba..f94b5ec06786 100644 > --- a/arch/openrisc/kernel/process.c > +++ b/arch/openrisc/kernel/process.c > @@ -125,10 +125,6 @@ void show_regs(struct pt_regs *regs) > show_registers(regs); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Copy the thread-specific (arch specific) info from the current > * process to the new one p > diff --git a/arch/parisc/include/asm/processor.h b/arch/parisc/include/asm/processor.h > index 4621ceb51314..a608970b249a 100644 > --- a/arch/parisc/include/asm/processor.h > +++ b/arch/parisc/include/asm/processor.h > @@ -266,9 +266,6 @@ on downward growing arches, it looks like this: > > 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); > > #define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0]) > diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c > index 7c37e09c92da..3db0e97e6c06 100644 > --- a/arch/parisc/kernel/process.c > +++ b/arch/parisc/kernel/process.c > @@ -146,10 +146,6 @@ void flush_thread(void) > */ > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Idle thread support > * > diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h > index fdfaae194ddd..92e332415d02 100644 > --- a/arch/powerpc/include/asm/processor.h > +++ b/arch/powerpc/include/asm/processor.h > @@ -75,7 +75,6 @@ extern int _chrp_type; > > struct task_struct; > 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_CKFPR(i) ckfp_state.fpr[i][TS_FPROFFSET] > diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c > index 0fbda89cd1bb..991cda25b9a9 100644 > --- a/arch/powerpc/kernel/process.c > +++ b/arch/powerpc/kernel/process.c > @@ -1655,11 +1655,6 @@ EXPORT_SYMBOL_GPL(set_thread_tidr); > > #endif /* CONFIG_PPC64 */ > > -void > -release_thread(struct task_struct *t) > -{ > -} > - > /* > * this gets called so that we can store coprocessor state into memory and > * copy the current task into the new thread. > diff --git a/arch/riscv/include/asm/processor.h b/arch/riscv/include/asm/processor.h > index 19eedd4af4cd..94a0590c6971 100644 > --- a/arch/riscv/include/asm/processor.h > +++ b/arch/riscv/include/asm/processor.h > @@ -65,11 +65,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, > extern void start_thread(struct pt_regs *regs, > 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); > > > diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h > index bd66f8e34949..c52fe651eeba 100644 > --- a/arch/s390/include/asm/processor.h > +++ b/arch/s390/include/asm/processor.h > @@ -186,9 +186,6 @@ struct pt_regs; > void show_registers(struct pt_regs *regs); > 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 */ > void guarded_storage_release(struct task_struct *tsk); > void gs_load_bc_cb(struct pt_regs *regs); > diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h > index 45240ec6b85a..27aebf1e75a2 100644 > --- a/arch/sh/include/asm/processor_32.h > +++ b/arch/sh/include/asm/processor_32.h > @@ -127,9 +127,6 @@ struct task_struct; > > 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. > */ > diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c > index a808843375e7..92b6649d4929 100644 > --- a/arch/sh/kernel/process_32.c > +++ b/arch/sh/kernel/process_32.c > @@ -84,11 +84,6 @@ void flush_thread(void) > #endif > } > > -void release_thread(struct task_struct *dead_task) > -{ > - /* do nothing */ > -} > - > asmlinkage void ret_from_fork(void); > asmlinkage void ret_from_kernel_thread(void); > > diff --git a/arch/sparc/include/asm/processor_32.h b/arch/sparc/include/asm/processor_32.h > index b26c35336b51..ba8b70ffec08 100644 > --- a/arch/sparc/include/asm/processor_32.h > +++ b/arch/sparc/include/asm/processor_32.h > @@ -80,9 +80,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc, > : "memory"); > } > > -/* Free all resources held by a thread. */ > -#define release_thread(tsk) do { } while(0) > - > unsigned long __get_wchan(struct task_struct *); > > #define task_pt_regs(tsk) ((tsk)->thread.kregs) > diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h > index 89850dff6b03..2667f35d5ea5 100644 > --- a/arch/sparc/include/asm/processor_64.h > +++ b/arch/sparc/include/asm/processor_64.h > @@ -176,9 +176,6 @@ do { \ > regs->tstate &= ~TSTATE_PEF; \ > } while (0) > > -/* Free all resources held by a thread. */ > -#define release_thread(tsk) do { } while (0) > - > unsigned long __get_wchan(struct task_struct *task); > > #define task_pt_regs(tsk) (task_thread_info(tsk)->kregs) > diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h > index d0fc1862da95..bb5f06480da9 100644 > --- a/arch/um/include/asm/processor-generic.h > +++ b/arch/um/include/asm/processor-generic.h > @@ -55,10 +55,6 @@ struct thread_struct { > .request = { 0 } \ > } > > -static inline void release_thread(struct task_struct *task) > -{ > -} > - > /* > * User space process size: 3GB (default). > */ > diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h > index 356308c73951..67c9d73b31fa 100644 > --- a/arch/x86/include/asm/processor.h > +++ b/arch/x86/include/asm/processor.h > @@ -587,9 +587,6 @@ static inline void load_sp0(unsigned long sp0) > > #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); > > /* > diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h > index 76bc63127c66..5abde43c570c 100644 > --- a/arch/xtensa/include/asm/processor.h > +++ b/arch/xtensa/include/asm/processor.h > @@ -221,9 +221,6 @@ struct thread_struct { > struct task_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); > > #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) > diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h > index 81cab4b01edc..d6c48163c6de 100644 > --- a/include/linux/sched/task.h > +++ b/include/linux/sched/task.h > @@ -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); > > +/* Free all architecture-specific resources held by a thread. */ > +void release_thread(struct task_struct *dead_task); > + > #ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT > extern int arch_task_struct_size __read_mostly; > #else > diff --git a/kernel/exit.c b/kernel/exit.c > index 80376b4ac763..30cabf933fed 100644 > --- a/kernel/exit.c > +++ b/kernel/exit.c > @@ -183,6 +183,10 @@ void put_task_struct_rcu_user(struct task_struct *task) > call_rcu(&task->rcu, delayed_put_task_struct); > } > > +void __weak release_thread(struct task_struct *dead_task) > +{ > +} > + > void release_task(struct task_struct *p) > { > struct task_struct *leader; > -- > 2.35.3 > -- Best Regards Guo Ren _______________________________________________ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 641C9C00140 for ; Fri, 19 Aug 2022 01:58:22 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4M84fN63C4z3f16 for ; Fri, 19 Aug 2022 11:58:20 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=o92Wkus4; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=139.178.84.217; helo=dfw.source.kernel.org; envelope-from=guoren@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=o92Wkus4; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4M84QY345nz3bVt for ; Fri, 19 Aug 2022 11:48:05 +1000 (AEST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 918DD6142E for ; Fri, 19 Aug 2022 01:48:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07263C43147 for ; Fri, 19 Aug 2022 01:48:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660873680; bh=5JatSOxYSIl5vDUQiorJPobY5OCnJz2Lpd3CiqC5c7c=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=o92Wkus4Gun/HKgQhH8d0eBMVCpmCdlW8KEESP8A4DPwvdJcQNGcvNjFA0WMGs275 darUrKzPyVpYB1fULzaeeoPvRwZC8ItbGQNcwte/iRmK9uYD1NXIOfxOlXNtOCwL/3 jnXMjpcPcPion0GnZi9gme1v4y8PqThy2wpEWiceMhTD+kBPb2kPE3AKyTKBTVpyeH aB54q2Aeo2PeRHQCoNRUW0qOagpmKrdNAG1f+3S2wVgU2Nn/A5Ud4dBf9qRX/+N4nD fIedb6JAK+px5I2d9CUo9JeeNcsglTkOzb9hFHkoTFeP/RFB5wCZ/L37eGR6OLunqJ VAHl5tf34822g== Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-11c4d7d4683so3756416fac.8 for ; Thu, 18 Aug 2022 18:47:59 -0700 (PDT) X-Gm-Message-State: ACgBeo0OELeEmIlMAi/cpDY+e7k3NBa4+YihcxtE+2rHoALvKNcFBUZD R/rL4vur6kJrcLn46srVEBRaacAelj8pIsevcR0= X-Google-Smtp-Source: AA6agR4OyqmepS4+VTsu9a8dSLWpo0jz7CjT66zOKAEPn9pWyDEV5uDKfXPjUxFtFMX/enUe8dxNMNdryyp/ovEVZgs= X-Received: by 2002:a05:6870:c596:b0:101:6409:ae62 with SMTP id ba22-20020a056870c59600b001016409ae62mr5559480oab.112.1660873668265; Thu, 18 Aug 2022 18:47:48 -0700 (PDT) MIME-Version: 1.0 References: <20220819014406.32266-1-wangkefeng.wang@huawei.com> In-Reply-To: <20220819014406.32266-1-wangkefeng.wang@huawei.com> From: Guo Ren Date: Fri, 19 Aug 2022 09:47:34 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kernel: exit: cleanup release_thread() To: Kefeng Wang Content-Type: text/plain; charset="UTF-8" X-Mailman-Approved-At: Fri, 19 Aug 2022 11:57:23 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rich Felker , Thomas Gleixner , linux-sh@vger.kernel.org, Catalin Marinas , Dave Hansen , x86@kernel.org, linux-mips@vger.kernel.org, "James E . J . Bottomley" , Max Filippov , linux-csky@vger.kernel.org, sparclinux@vger.kernel.org, linux-hexagon@vger.kernel.org, WANG Xuerui , Will Deacon , Alexander Gordeev , Anton Ivanov , Jonas Bonn , linux-s390@vger.kernel.org, linux-ia64@vger.kernel.org, linux-snps-arc@lists.infradead.org, Yoshinori Sato , Helge Deller , Huacai Chen , Russell King , Ingo Molnar , Geert Uytterhoeven , Vineet Gupta , Matt Turner , Christ ian Borntraeger , linux-xtensa@linux-xtensa.org, Vasily Gorbik , Chris Zankel , linux-um@lists.infradead.org, Heiko Carstens , linux-alpha@vger.kernel.org, Richard Henderson , Nicholas Piggin , Stefan Kristiansson , linux-m68k@lists.linux-m68k.org, openrisc@lists.librecores.org, Ivan Kokshaysky , loongarch@lists.linux.dev, Paul Walmsley , Stafford Horne , akpm@linux-foundation.org, linux-arm-kernel@lists.infradead.org, Brian Cain , Michal Simek , Thomas Bogendoerfer , linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, Dinh Nguyen , linux-riscv@lists.infradead.org, Palmer Dabbelt , Sven Schnelle , Richard Weinberger , Borislav Petkov , Johannes Berg , linuxppc-dev@lists.ozlabs.org, "David S . Miller" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" For csky part Acked-by: Guo Ren On Fri, Aug 19, 2022 at 9:39 AM Kefeng Wang wrote: > > Only x86 has own release_thread(), introduce a new weak > release_thread() function to clean empty definitions in > other ARCHs. > > Signed-off-by: Kefeng Wang > --- > arch/alpha/include/asm/processor.h | 2 -- > arch/alpha/kernel/process.c | 5 ----- > arch/arc/include/asm/processor.h | 3 --- > arch/arm/include/asm/processor.h | 3 --- > arch/arm/kernel/process.c | 4 ---- > arch/arm64/include/asm/processor.h | 3 --- > arch/arm64/kernel/process.c | 4 ---- > arch/csky/include/asm/processor.h | 5 ----- > arch/hexagon/include/asm/processor.h | 4 ---- > arch/hexagon/kernel/process.c | 7 ------- > arch/ia64/include/asm/processor.h | 7 ------- > arch/loongarch/include/asm/processor.h | 3 --- > arch/m68k/include/asm/processor.h | 5 ----- > arch/microblaze/include/asm/processor.h | 5 ----- > arch/mips/include/asm/processor.h | 3 --- > arch/nios2/include/asm/processor.h | 5 ----- > arch/openrisc/include/asm/processor.h | 1 - > arch/openrisc/kernel/process.c | 4 ---- > arch/parisc/include/asm/processor.h | 3 --- > arch/parisc/kernel/process.c | 4 ---- > arch/powerpc/include/asm/processor.h | 1 - > arch/powerpc/kernel/process.c | 5 ----- > arch/riscv/include/asm/processor.h | 5 ----- > arch/s390/include/asm/processor.h | 3 --- > arch/sh/include/asm/processor_32.h | 3 --- > arch/sh/kernel/process_32.c | 5 ----- > arch/sparc/include/asm/processor_32.h | 3 --- > arch/sparc/include/asm/processor_64.h | 3 --- > arch/um/include/asm/processor-generic.h | 4 ---- > arch/x86/include/asm/processor.h | 3 --- > arch/xtensa/include/asm/processor.h | 3 --- > include/linux/sched/task.h | 3 +++ > kernel/exit.c | 4 ++++ > 33 files changed, 7 insertions(+), 118 deletions(-) > > diff --git a/arch/alpha/include/asm/processor.h b/arch/alpha/include/asm/processor.h > index 43e234c518b1..714abe494e5f 100644 > --- a/arch/alpha/include/asm/processor.h > +++ b/arch/alpha/include/asm/processor.h > @@ -36,8 +36,6 @@ extern void start_thread(struct pt_regs *, unsigned long, unsigned long); > > /* Free all resources held by a thread. */ > struct task_struct; > -extern void release_thread(struct task_struct *); > - > unsigned long __get_wchan(struct task_struct *p); > > #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) > diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c > index e2e25f8b5e76..dbf1bc5e2ad2 100644 > --- a/arch/alpha/kernel/process.c > +++ b/arch/alpha/kernel/process.c > @@ -225,11 +225,6 @@ flush_thread(void) > current_thread_info()->pcb.unique = 0; > } > > -void > -release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Copy architecture-specific thread state > */ > diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h > index 54db9d7bb562..fb844fce1ab6 100644 > --- a/arch/arc/include/asm/processor.h > +++ b/arch/arc/include/asm/processor.h > @@ -43,9 +43,6 @@ struct task_struct; > #define task_pt_regs(p) \ > ((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 > * get optimised away by gcc > diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h > index bdc35c0e8dfb..326864f79d18 100644 > --- a/arch/arm/include/asm/processor.h > +++ b/arch/arm/include/asm/processor.h > @@ -81,9 +81,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, > /* Forward declaration, a strange C thing */ > 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); > > #define task_pt_regs(p) \ > diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c > index 3d9cace63884..712d3e6d9be9 100644 > --- a/arch/arm/kernel/process.c > +++ b/arch/arm/kernel/process.c > @@ -232,10 +232,6 @@ void flush_thread(void) > thread_notify(THREAD_NOTIFY_FLUSH, thread); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); > > int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) > diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h > index 86eb0bfe3b38..4cfb4cd1d475 100644 > --- a/arch/arm64/include/asm/processor.h > +++ b/arch/arm64/include/asm/processor.h > @@ -323,9 +323,6 @@ static inline bool is_ttbr1_addr(unsigned long addr) > /* Forward declaration, a strange C thing */ > 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); > > void update_sctlr_el1(u64 sctlr); > diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c > index 92bcc1768f0b..9015f49c206e 100644 > --- a/arch/arm64/kernel/process.c > +++ b/arch/arm64/kernel/process.c > @@ -279,10 +279,6 @@ void flush_thread(void) > flush_tagged_addr_state(); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > void arch_release_task_struct(struct task_struct *tsk) > { > fpsimd_release_task(tsk); > diff --git a/arch/csky/include/asm/processor.h b/arch/csky/include/asm/processor.h > index 9638206bc44f..63ad71fab30d 100644 > --- a/arch/csky/include/asm/processor.h > +++ b/arch/csky/include/asm/processor.h > @@ -69,11 +69,6 @@ do { \ > /* Forward declaration, a strange C thing */ > 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 */ > #define prepare_to_copy(tsk) do { } while (0) > > diff --git a/arch/hexagon/include/asm/processor.h b/arch/hexagon/include/asm/processor.h > index 615f7e49968e..0cd39c2cdf8f 100644 > --- a/arch/hexagon/include/asm/processor.h > +++ b/arch/hexagon/include/asm/processor.h > @@ -60,10 +60,6 @@ struct thread_struct { > #define KSTK_EIP(tsk) (pt_elr(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); > > /* The following stuff is pretty HEXAGON specific. */ > diff --git a/arch/hexagon/kernel/process.c b/arch/hexagon/kernel/process.c > index f0552f98a7ba..e15eeaebd785 100644 > --- a/arch/hexagon/kernel/process.c > +++ b/arch/hexagon/kernel/process.c > @@ -112,13 +112,6 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) > 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 > */ > diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h > index 757c2f6d8d4b..d1978e004054 100644 > --- a/arch/ia64/include/asm/processor.h > +++ b/arch/ia64/include/asm/processor.h > @@ -318,13 +318,6 @@ struct thread_struct { > struct mm_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. */ > extern unsigned long __get_wchan (struct task_struct *p); > > diff --git a/arch/loongarch/include/asm/processor.h b/arch/loongarch/include/asm/processor.h > index 1c4b4308378d..6954dc5d24e9 100644 > --- a/arch/loongarch/include/asm/processor.h > +++ b/arch/loongarch/include/asm/processor.h > @@ -176,9 +176,6 @@ struct thread_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}; > > extern unsigned long boot_option_idle_override; > diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h > index d86b4009880b..7a2da780830b 100644 > --- a/arch/m68k/include/asm/processor.h > +++ b/arch/m68k/include/asm/processor.h > @@ -145,11 +145,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc, > /* Forward declaration, a strange C thing */ > 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); > void show_registers(struct pt_regs *regs); > > diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h > index 7e9e92670df3..4e193c7550df 100644 > --- a/arch/microblaze/include/asm/processor.h > +++ b/arch/microblaze/include/asm/processor.h > @@ -63,11 +63,6 @@ struct thread_struct { > .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); > > /* The size allocated for kernel stacks. This _must_ be a power of two! */ > diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h > index 4bb24579d12e..3fde1ff72bd1 100644 > --- a/arch/mips/include/asm/processor.h > +++ b/arch/mips/include/asm/processor.h > @@ -344,9 +344,6 @@ struct thread_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. > */ > diff --git a/arch/nios2/include/asm/processor.h b/arch/nios2/include/asm/processor.h > index b8125dfbcad2..8916d93d5c2d 100644 > --- a/arch/nios2/include/asm/processor.h > +++ b/arch/nios2/include/asm/processor.h > @@ -64,11 +64,6 @@ extern void start_thread(struct pt_regs *regs, unsigned long pc, > > 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); > > #define task_pt_regs(p) \ > diff --git a/arch/openrisc/include/asm/processor.h b/arch/openrisc/include/asm/processor.h > index aa1699c18add..ed9efb430afa 100644 > --- a/arch/openrisc/include/asm/processor.h > +++ b/arch/openrisc/include/asm/processor.h > @@ -72,7 +72,6 @@ struct thread_struct { > > > 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); > > #define cpu_relax() barrier() > diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c > index 52dc983ddeba..f94b5ec06786 100644 > --- a/arch/openrisc/kernel/process.c > +++ b/arch/openrisc/kernel/process.c > @@ -125,10 +125,6 @@ void show_regs(struct pt_regs *regs) > show_registers(regs); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Copy the thread-specific (arch specific) info from the current > * process to the new one p > diff --git a/arch/parisc/include/asm/processor.h b/arch/parisc/include/asm/processor.h > index 4621ceb51314..a608970b249a 100644 > --- a/arch/parisc/include/asm/processor.h > +++ b/arch/parisc/include/asm/processor.h > @@ -266,9 +266,6 @@ on downward growing arches, it looks like this: > > 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); > > #define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0]) > diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c > index 7c37e09c92da..3db0e97e6c06 100644 > --- a/arch/parisc/kernel/process.c > +++ b/arch/parisc/kernel/process.c > @@ -146,10 +146,6 @@ void flush_thread(void) > */ > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Idle thread support > * > diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h > index fdfaae194ddd..92e332415d02 100644 > --- a/arch/powerpc/include/asm/processor.h > +++ b/arch/powerpc/include/asm/processor.h > @@ -75,7 +75,6 @@ extern int _chrp_type; > > struct task_struct; > 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_CKFPR(i) ckfp_state.fpr[i][TS_FPROFFSET] > diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c > index 0fbda89cd1bb..991cda25b9a9 100644 > --- a/arch/powerpc/kernel/process.c > +++ b/arch/powerpc/kernel/process.c > @@ -1655,11 +1655,6 @@ EXPORT_SYMBOL_GPL(set_thread_tidr); > > #endif /* CONFIG_PPC64 */ > > -void > -release_thread(struct task_struct *t) > -{ > -} > - > /* > * this gets called so that we can store coprocessor state into memory and > * copy the current task into the new thread. > diff --git a/arch/riscv/include/asm/processor.h b/arch/riscv/include/asm/processor.h > index 19eedd4af4cd..94a0590c6971 100644 > --- a/arch/riscv/include/asm/processor.h > +++ b/arch/riscv/include/asm/processor.h > @@ -65,11 +65,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, > extern void start_thread(struct pt_regs *regs, > 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); > > > diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h > index bd66f8e34949..c52fe651eeba 100644 > --- a/arch/s390/include/asm/processor.h > +++ b/arch/s390/include/asm/processor.h > @@ -186,9 +186,6 @@ struct pt_regs; > void show_registers(struct pt_regs *regs); > 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 */ > void guarded_storage_release(struct task_struct *tsk); > void gs_load_bc_cb(struct pt_regs *regs); > diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h > index 45240ec6b85a..27aebf1e75a2 100644 > --- a/arch/sh/include/asm/processor_32.h > +++ b/arch/sh/include/asm/processor_32.h > @@ -127,9 +127,6 @@ struct task_struct; > > 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. > */ > diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c > index a808843375e7..92b6649d4929 100644 > --- a/arch/sh/kernel/process_32.c > +++ b/arch/sh/kernel/process_32.c > @@ -84,11 +84,6 @@ void flush_thread(void) > #endif > } > > -void release_thread(struct task_struct *dead_task) > -{ > - /* do nothing */ > -} > - > asmlinkage void ret_from_fork(void); > asmlinkage void ret_from_kernel_thread(void); > > diff --git a/arch/sparc/include/asm/processor_32.h b/arch/sparc/include/asm/processor_32.h > index b26c35336b51..ba8b70ffec08 100644 > --- a/arch/sparc/include/asm/processor_32.h > +++ b/arch/sparc/include/asm/processor_32.h > @@ -80,9 +80,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc, > : "memory"); > } > > -/* Free all resources held by a thread. */ > -#define release_thread(tsk) do { } while(0) > - > unsigned long __get_wchan(struct task_struct *); > > #define task_pt_regs(tsk) ((tsk)->thread.kregs) > diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h > index 89850dff6b03..2667f35d5ea5 100644 > --- a/arch/sparc/include/asm/processor_64.h > +++ b/arch/sparc/include/asm/processor_64.h > @@ -176,9 +176,6 @@ do { \ > regs->tstate &= ~TSTATE_PEF; \ > } while (0) > > -/* Free all resources held by a thread. */ > -#define release_thread(tsk) do { } while (0) > - > unsigned long __get_wchan(struct task_struct *task); > > #define task_pt_regs(tsk) (task_thread_info(tsk)->kregs) > diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h > index d0fc1862da95..bb5f06480da9 100644 > --- a/arch/um/include/asm/processor-generic.h > +++ b/arch/um/include/asm/processor-generic.h > @@ -55,10 +55,6 @@ struct thread_struct { > .request = { 0 } \ > } > > -static inline void release_thread(struct task_struct *task) > -{ > -} > - > /* > * User space process size: 3GB (default). > */ > diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h > index 356308c73951..67c9d73b31fa 100644 > --- a/arch/x86/include/asm/processor.h > +++ b/arch/x86/include/asm/processor.h > @@ -587,9 +587,6 @@ static inline void load_sp0(unsigned long sp0) > > #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); > > /* > diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h > index 76bc63127c66..5abde43c570c 100644 > --- a/arch/xtensa/include/asm/processor.h > +++ b/arch/xtensa/include/asm/processor.h > @@ -221,9 +221,6 @@ struct thread_struct { > struct task_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); > > #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) > diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h > index 81cab4b01edc..d6c48163c6de 100644 > --- a/include/linux/sched/task.h > +++ b/include/linux/sched/task.h > @@ -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); > > +/* Free all architecture-specific resources held by a thread. */ > +void release_thread(struct task_struct *dead_task); > + > #ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT > extern int arch_task_struct_size __read_mostly; > #else > diff --git a/kernel/exit.c b/kernel/exit.c > index 80376b4ac763..30cabf933fed 100644 > --- a/kernel/exit.c > +++ b/kernel/exit.c > @@ -183,6 +183,10 @@ void put_task_struct_rcu_user(struct task_struct *task) > call_rcu(&task->rcu, delayed_put_task_struct); > } > > +void __weak release_thread(struct task_struct *dead_task) > +{ > +} > + > void release_task(struct task_struct *p) > { > struct task_struct *leader; > -- > 2.35.3 > -- Best Regards Guo Ren From mboxrd@z Thu Jan 1 00:00:00 1970 From: Guo Ren Date: Fri, 19 Aug 2022 01:47:34 +0000 Subject: Re: [PATCH] kernel: exit: cleanup release_thread() Message-Id: List-Id: References: <20220819014406.32266-1-wangkefeng.wang@huawei.com> In-Reply-To: <20220819014406.32266-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Kefeng Wang Cc: Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Catalin Marinas , Will Deacon , Brian Cain , Huacai Chen , WANG Xuerui , Geert Uytterhoeven , Michal Simek , Thomas Bogendoerfer , Dinh Nguyen , Jonas Bonn , Stefan Kristiansson , Stafford Horne , "James E . J . Bottomley" , Helge Deller , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Paul Walmsley , Palmer Dabbelt , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Yoshinori Sato , Rich Felker , "David S . Miller" , Richard Weinberger , Anton Ivanov , Johannes Berg , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Chris Zankel , Max Filippov , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, linux-xtensa@linux-xtensa.org, akpm@linux-foundation.org For csky part Acked-by: Guo Ren On Fri, Aug 19, 2022 at 9:39 AM Kefeng Wang wrote: > > Only x86 has own release_thread(), introduce a new weak > release_thread() function to clean empty definitions in > other ARCHs. > > Signed-off-by: Kefeng Wang > --- > arch/alpha/include/asm/processor.h | 2 -- > arch/alpha/kernel/process.c | 5 ----- > arch/arc/include/asm/processor.h | 3 --- > arch/arm/include/asm/processor.h | 3 --- > arch/arm/kernel/process.c | 4 ---- > arch/arm64/include/asm/processor.h | 3 --- > arch/arm64/kernel/process.c | 4 ---- > arch/csky/include/asm/processor.h | 5 ----- > arch/hexagon/include/asm/processor.h | 4 ---- > arch/hexagon/kernel/process.c | 7 ------- > arch/ia64/include/asm/processor.h | 7 ------- > arch/loongarch/include/asm/processor.h | 3 --- > arch/m68k/include/asm/processor.h | 5 ----- > arch/microblaze/include/asm/processor.h | 5 ----- > arch/mips/include/asm/processor.h | 3 --- > arch/nios2/include/asm/processor.h | 5 ----- > arch/openrisc/include/asm/processor.h | 1 - > arch/openrisc/kernel/process.c | 4 ---- > arch/parisc/include/asm/processor.h | 3 --- > arch/parisc/kernel/process.c | 4 ---- > arch/powerpc/include/asm/processor.h | 1 - > arch/powerpc/kernel/process.c | 5 ----- > arch/riscv/include/asm/processor.h | 5 ----- > arch/s390/include/asm/processor.h | 3 --- > arch/sh/include/asm/processor_32.h | 3 --- > arch/sh/kernel/process_32.c | 5 ----- > arch/sparc/include/asm/processor_32.h | 3 --- > arch/sparc/include/asm/processor_64.h | 3 --- > arch/um/include/asm/processor-generic.h | 4 ---- > arch/x86/include/asm/processor.h | 3 --- > arch/xtensa/include/asm/processor.h | 3 --- > include/linux/sched/task.h | 3 +++ > kernel/exit.c | 4 ++++ > 33 files changed, 7 insertions(+), 118 deletions(-) > > diff --git a/arch/alpha/include/asm/processor.h b/arch/alpha/include/asm/processor.h > index 43e234c518b1..714abe494e5f 100644 > --- a/arch/alpha/include/asm/processor.h > +++ b/arch/alpha/include/asm/processor.h > @@ -36,8 +36,6 @@ extern void start_thread(struct pt_regs *, unsigned long, unsigned long); > > /* Free all resources held by a thread. */ > struct task_struct; > -extern void release_thread(struct task_struct *); > - > unsigned long __get_wchan(struct task_struct *p); > > #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) > diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c > index e2e25f8b5e76..dbf1bc5e2ad2 100644 > --- a/arch/alpha/kernel/process.c > +++ b/arch/alpha/kernel/process.c > @@ -225,11 +225,6 @@ flush_thread(void) > current_thread_info()->pcb.unique = 0; > } > > -void > -release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Copy architecture-specific thread state > */ > diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h > index 54db9d7bb562..fb844fce1ab6 100644 > --- a/arch/arc/include/asm/processor.h > +++ b/arch/arc/include/asm/processor.h > @@ -43,9 +43,6 @@ struct task_struct; > #define task_pt_regs(p) \ > ((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 > * get optimised away by gcc > diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h > index bdc35c0e8dfb..326864f79d18 100644 > --- a/arch/arm/include/asm/processor.h > +++ b/arch/arm/include/asm/processor.h > @@ -81,9 +81,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, > /* Forward declaration, a strange C thing */ > 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); > > #define task_pt_regs(p) \ > diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c > index 3d9cace63884..712d3e6d9be9 100644 > --- a/arch/arm/kernel/process.c > +++ b/arch/arm/kernel/process.c > @@ -232,10 +232,6 @@ void flush_thread(void) > thread_notify(THREAD_NOTIFY_FLUSH, thread); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); > > int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) > diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h > index 86eb0bfe3b38..4cfb4cd1d475 100644 > --- a/arch/arm64/include/asm/processor.h > +++ b/arch/arm64/include/asm/processor.h > @@ -323,9 +323,6 @@ static inline bool is_ttbr1_addr(unsigned long addr) > /* Forward declaration, a strange C thing */ > 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); > > void update_sctlr_el1(u64 sctlr); > diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c > index 92bcc1768f0b..9015f49c206e 100644 > --- a/arch/arm64/kernel/process.c > +++ b/arch/arm64/kernel/process.c > @@ -279,10 +279,6 @@ void flush_thread(void) > flush_tagged_addr_state(); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > void arch_release_task_struct(struct task_struct *tsk) > { > fpsimd_release_task(tsk); > diff --git a/arch/csky/include/asm/processor.h b/arch/csky/include/asm/processor.h > index 9638206bc44f..63ad71fab30d 100644 > --- a/arch/csky/include/asm/processor.h > +++ b/arch/csky/include/asm/processor.h > @@ -69,11 +69,6 @@ do { \ > /* Forward declaration, a strange C thing */ > 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 */ > #define prepare_to_copy(tsk) do { } while (0) > > diff --git a/arch/hexagon/include/asm/processor.h b/arch/hexagon/include/asm/processor.h > index 615f7e49968e..0cd39c2cdf8f 100644 > --- a/arch/hexagon/include/asm/processor.h > +++ b/arch/hexagon/include/asm/processor.h > @@ -60,10 +60,6 @@ struct thread_struct { > #define KSTK_EIP(tsk) (pt_elr(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); > > /* The following stuff is pretty HEXAGON specific. */ > diff --git a/arch/hexagon/kernel/process.c b/arch/hexagon/kernel/process.c > index f0552f98a7ba..e15eeaebd785 100644 > --- a/arch/hexagon/kernel/process.c > +++ b/arch/hexagon/kernel/process.c > @@ -112,13 +112,6 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) > 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 > */ > diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h > index 757c2f6d8d4b..d1978e004054 100644 > --- a/arch/ia64/include/asm/processor.h > +++ b/arch/ia64/include/asm/processor.h > @@ -318,13 +318,6 @@ struct thread_struct { > struct mm_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. */ > extern unsigned long __get_wchan (struct task_struct *p); > > diff --git a/arch/loongarch/include/asm/processor.h b/arch/loongarch/include/asm/processor.h > index 1c4b4308378d..6954dc5d24e9 100644 > --- a/arch/loongarch/include/asm/processor.h > +++ b/arch/loongarch/include/asm/processor.h > @@ -176,9 +176,6 @@ struct thread_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}; > > extern unsigned long boot_option_idle_override; > diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h > index d86b4009880b..7a2da780830b 100644 > --- a/arch/m68k/include/asm/processor.h > +++ b/arch/m68k/include/asm/processor.h > @@ -145,11 +145,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc, > /* Forward declaration, a strange C thing */ > 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); > void show_registers(struct pt_regs *regs); > > diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h > index 7e9e92670df3..4e193c7550df 100644 > --- a/arch/microblaze/include/asm/processor.h > +++ b/arch/microblaze/include/asm/processor.h > @@ -63,11 +63,6 @@ struct thread_struct { > .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); > > /* The size allocated for kernel stacks. This _must_ be a power of two! */ > diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h > index 4bb24579d12e..3fde1ff72bd1 100644 > --- a/arch/mips/include/asm/processor.h > +++ b/arch/mips/include/asm/processor.h > @@ -344,9 +344,6 @@ struct thread_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. > */ > diff --git a/arch/nios2/include/asm/processor.h b/arch/nios2/include/asm/processor.h > index b8125dfbcad2..8916d93d5c2d 100644 > --- a/arch/nios2/include/asm/processor.h > +++ b/arch/nios2/include/asm/processor.h > @@ -64,11 +64,6 @@ extern void start_thread(struct pt_regs *regs, unsigned long pc, > > 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); > > #define task_pt_regs(p) \ > diff --git a/arch/openrisc/include/asm/processor.h b/arch/openrisc/include/asm/processor.h > index aa1699c18add..ed9efb430afa 100644 > --- a/arch/openrisc/include/asm/processor.h > +++ b/arch/openrisc/include/asm/processor.h > @@ -72,7 +72,6 @@ struct thread_struct { > > > 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); > > #define cpu_relax() barrier() > diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c > index 52dc983ddeba..f94b5ec06786 100644 > --- a/arch/openrisc/kernel/process.c > +++ b/arch/openrisc/kernel/process.c > @@ -125,10 +125,6 @@ void show_regs(struct pt_regs *regs) > show_registers(regs); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Copy the thread-specific (arch specific) info from the current > * process to the new one p > diff --git a/arch/parisc/include/asm/processor.h b/arch/parisc/include/asm/processor.h > index 4621ceb51314..a608970b249a 100644 > --- a/arch/parisc/include/asm/processor.h > +++ b/arch/parisc/include/asm/processor.h > @@ -266,9 +266,6 @@ on downward growing arches, it looks like this: > > 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); > > #define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0]) > diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c > index 7c37e09c92da..3db0e97e6c06 100644 > --- a/arch/parisc/kernel/process.c > +++ b/arch/parisc/kernel/process.c > @@ -146,10 +146,6 @@ void flush_thread(void) > */ > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Idle thread support > * > diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h > index fdfaae194ddd..92e332415d02 100644 > --- a/arch/powerpc/include/asm/processor.h > +++ b/arch/powerpc/include/asm/processor.h > @@ -75,7 +75,6 @@ extern int _chrp_type; > > struct task_struct; > 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_CKFPR(i) ckfp_state.fpr[i][TS_FPROFFSET] > diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c > index 0fbda89cd1bb..991cda25b9a9 100644 > --- a/arch/powerpc/kernel/process.c > +++ b/arch/powerpc/kernel/process.c > @@ -1655,11 +1655,6 @@ EXPORT_SYMBOL_GPL(set_thread_tidr); > > #endif /* CONFIG_PPC64 */ > > -void > -release_thread(struct task_struct *t) > -{ > -} > - > /* > * this gets called so that we can store coprocessor state into memory and > * copy the current task into the new thread. > diff --git a/arch/riscv/include/asm/processor.h b/arch/riscv/include/asm/processor.h > index 19eedd4af4cd..94a0590c6971 100644 > --- a/arch/riscv/include/asm/processor.h > +++ b/arch/riscv/include/asm/processor.h > @@ -65,11 +65,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, > extern void start_thread(struct pt_regs *regs, > 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); > > > diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h > index bd66f8e34949..c52fe651eeba 100644 > --- a/arch/s390/include/asm/processor.h > +++ b/arch/s390/include/asm/processor.h > @@ -186,9 +186,6 @@ struct pt_regs; > void show_registers(struct pt_regs *regs); > 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 */ > void guarded_storage_release(struct task_struct *tsk); > void gs_load_bc_cb(struct pt_regs *regs); > diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h > index 45240ec6b85a..27aebf1e75a2 100644 > --- a/arch/sh/include/asm/processor_32.h > +++ b/arch/sh/include/asm/processor_32.h > @@ -127,9 +127,6 @@ struct task_struct; > > 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. > */ > diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c > index a808843375e7..92b6649d4929 100644 > --- a/arch/sh/kernel/process_32.c > +++ b/arch/sh/kernel/process_32.c > @@ -84,11 +84,6 @@ void flush_thread(void) > #endif > } > > -void release_thread(struct task_struct *dead_task) > -{ > - /* do nothing */ > -} > - > asmlinkage void ret_from_fork(void); > asmlinkage void ret_from_kernel_thread(void); > > diff --git a/arch/sparc/include/asm/processor_32.h b/arch/sparc/include/asm/processor_32.h > index b26c35336b51..ba8b70ffec08 100644 > --- a/arch/sparc/include/asm/processor_32.h > +++ b/arch/sparc/include/asm/processor_32.h > @@ -80,9 +80,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc, > : "memory"); > } > > -/* Free all resources held by a thread. */ > -#define release_thread(tsk) do { } while(0) > - > unsigned long __get_wchan(struct task_struct *); > > #define task_pt_regs(tsk) ((tsk)->thread.kregs) > diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h > index 89850dff6b03..2667f35d5ea5 100644 > --- a/arch/sparc/include/asm/processor_64.h > +++ b/arch/sparc/include/asm/processor_64.h > @@ -176,9 +176,6 @@ do { \ > regs->tstate &= ~TSTATE_PEF; \ > } while (0) > > -/* Free all resources held by a thread. */ > -#define release_thread(tsk) do { } while (0) > - > unsigned long __get_wchan(struct task_struct *task); > > #define task_pt_regs(tsk) (task_thread_info(tsk)->kregs) > diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h > index d0fc1862da95..bb5f06480da9 100644 > --- a/arch/um/include/asm/processor-generic.h > +++ b/arch/um/include/asm/processor-generic.h > @@ -55,10 +55,6 @@ struct thread_struct { > .request = { 0 } \ > } > > -static inline void release_thread(struct task_struct *task) > -{ > -} > - > /* > * User space process size: 3GB (default). > */ > diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h > index 356308c73951..67c9d73b31fa 100644 > --- a/arch/x86/include/asm/processor.h > +++ b/arch/x86/include/asm/processor.h > @@ -587,9 +587,6 @@ static inline void load_sp0(unsigned long sp0) > > #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); > > /* > diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h > index 76bc63127c66..5abde43c570c 100644 > --- a/arch/xtensa/include/asm/processor.h > +++ b/arch/xtensa/include/asm/processor.h > @@ -221,9 +221,6 @@ struct thread_struct { > struct task_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); > > #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) > diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h > index 81cab4b01edc..d6c48163c6de 100644 > --- a/include/linux/sched/task.h > +++ b/include/linux/sched/task.h > @@ -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); > > +/* Free all architecture-specific resources held by a thread. */ > +void release_thread(struct task_struct *dead_task); > + > #ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT > extern int arch_task_struct_size __read_mostly; > #else > diff --git a/kernel/exit.c b/kernel/exit.c > index 80376b4ac763..30cabf933fed 100644 > --- a/kernel/exit.c > +++ b/kernel/exit.c > @@ -183,6 +183,10 @@ void put_task_struct_rcu_user(struct task_struct *task) > call_rcu(&task->rcu, delayed_put_task_struct); > } > > +void __weak release_thread(struct task_struct *dead_task) > +{ > +} > + > void release_task(struct task_struct *p) > { > struct task_struct *leader; > -- > 2.35.3 > -- Best Regards Guo Ren From mboxrd@z Thu Jan 1 00:00:00 1970 From: Guo Ren Subject: Re: [PATCH] kernel: exit: cleanup release_thread() Date: Fri, 19 Aug 2022 09:47:34 +0800 Message-ID: References: <20220819014406.32266-1-wangkefeng.wang@huawei.com> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660873680; bh=5JatSOxYSIl5vDUQiorJPobY5OCnJz2Lpd3CiqC5c7c=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=o92Wkus4Gun/HKgQhH8d0eBMVCpmCdlW8KEESP8A4DPwvdJcQNGcvNjFA0WMGs275 darUrKzPyVpYB1fULzaeeoPvRwZC8ItbGQNcwte/iRmK9uYD1NXIOfxOlXNtOCwL/3 jnXMjpcPcPion0GnZi9gme1v4y8PqThy2wpEWiceMhTD+kBPb2kPE3AKyTKBTVpyeH aB54q2Aeo2PeRHQCoNRUW0qOagpmKrdNAG1f+3S2wVgU2Nn/A5Ud4dBf9qRX/+N4nD fIedb6JAK+px5I2d9CUo9JeeNcsglTkOzb9hFHkoTFeP/RFB5wCZ/L37eGR6OLunqJ VAHl5tf34822g== In-Reply-To: <20220819014406.32266-1-wangkefeng.wang@huawei.com> List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Kefeng Wang Cc: Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Catalin Marinas , Will Deacon , Brian Cain , Huacai Chen , WANG Xuerui , Geert Uytterhoeven , Michal Simek , Thomas Bogendoerfer , Dinh Nguyen , Jonas Bonn , Stefan Kristiansson , Stafford Horne , "James E . J . Bottomley" , Helge Deller For csky part Acked-by: Guo Ren On Fri, Aug 19, 2022 at 9:39 AM Kefeng Wang wrote: > > Only x86 has own release_thread(), introduce a new weak > release_thread() function to clean empty definitions in > other ARCHs. > > Signed-off-by: Kefeng Wang > --- > arch/alpha/include/asm/processor.h | 2 -- > arch/alpha/kernel/process.c | 5 ----- > arch/arc/include/asm/processor.h | 3 --- > arch/arm/include/asm/processor.h | 3 --- > arch/arm/kernel/process.c | 4 ---- > arch/arm64/include/asm/processor.h | 3 --- > arch/arm64/kernel/process.c | 4 ---- > arch/csky/include/asm/processor.h | 5 ----- > arch/hexagon/include/asm/processor.h | 4 ---- > arch/hexagon/kernel/process.c | 7 ------- > arch/ia64/include/asm/processor.h | 7 ------- > arch/loongarch/include/asm/processor.h | 3 --- > arch/m68k/include/asm/processor.h | 5 ----- > arch/microblaze/include/asm/processor.h | 5 ----- > arch/mips/include/asm/processor.h | 3 --- > arch/nios2/include/asm/processor.h | 5 ----- > arch/openrisc/include/asm/processor.h | 1 - > arch/openrisc/kernel/process.c | 4 ---- > arch/parisc/include/asm/processor.h | 3 --- > arch/parisc/kernel/process.c | 4 ---- > arch/powerpc/include/asm/processor.h | 1 - > arch/powerpc/kernel/process.c | 5 ----- > arch/riscv/include/asm/processor.h | 5 ----- > arch/s390/include/asm/processor.h | 3 --- > arch/sh/include/asm/processor_32.h | 3 --- > arch/sh/kernel/process_32.c | 5 ----- > arch/sparc/include/asm/processor_32.h | 3 --- > arch/sparc/include/asm/processor_64.h | 3 --- > arch/um/include/asm/processor-generic.h | 4 ---- > arch/x86/include/asm/processor.h | 3 --- > arch/xtensa/include/asm/processor.h | 3 --- > include/linux/sched/task.h | 3 +++ > kernel/exit.c | 4 ++++ > 33 files changed, 7 insertions(+), 118 deletions(-) > > diff --git a/arch/alpha/include/asm/processor.h b/arch/alpha/include/asm/processor.h > index 43e234c518b1..714abe494e5f 100644 > --- a/arch/alpha/include/asm/processor.h > +++ b/arch/alpha/include/asm/processor.h > @@ -36,8 +36,6 @@ extern void start_thread(struct pt_regs *, unsigned long, unsigned long); > > /* Free all resources held by a thread. */ > struct task_struct; > -extern void release_thread(struct task_struct *); > - > unsigned long __get_wchan(struct task_struct *p); > > #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) > diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c > index e2e25f8b5e76..dbf1bc5e2ad2 100644 > --- a/arch/alpha/kernel/process.c > +++ b/arch/alpha/kernel/process.c > @@ -225,11 +225,6 @@ flush_thread(void) > current_thread_info()->pcb.unique = 0; > } > > -void > -release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Copy architecture-specific thread state > */ > diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h > index 54db9d7bb562..fb844fce1ab6 100644 > --- a/arch/arc/include/asm/processor.h > +++ b/arch/arc/include/asm/processor.h > @@ -43,9 +43,6 @@ struct task_struct; > #define task_pt_regs(p) \ > ((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 > * get optimised away by gcc > diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h > index bdc35c0e8dfb..326864f79d18 100644 > --- a/arch/arm/include/asm/processor.h > +++ b/arch/arm/include/asm/processor.h > @@ -81,9 +81,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, > /* Forward declaration, a strange C thing */ > 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); > > #define task_pt_regs(p) \ > diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c > index 3d9cace63884..712d3e6d9be9 100644 > --- a/arch/arm/kernel/process.c > +++ b/arch/arm/kernel/process.c > @@ -232,10 +232,6 @@ void flush_thread(void) > thread_notify(THREAD_NOTIFY_FLUSH, thread); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); > > int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) > diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h > index 86eb0bfe3b38..4cfb4cd1d475 100644 > --- a/arch/arm64/include/asm/processor.h > +++ b/arch/arm64/include/asm/processor.h > @@ -323,9 +323,6 @@ static inline bool is_ttbr1_addr(unsigned long addr) > /* Forward declaration, a strange C thing */ > 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); > > void update_sctlr_el1(u64 sctlr); > diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c > index 92bcc1768f0b..9015f49c206e 100644 > --- a/arch/arm64/kernel/process.c > +++ b/arch/arm64/kernel/process.c > @@ -279,10 +279,6 @@ void flush_thread(void) > flush_tagged_addr_state(); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > void arch_release_task_struct(struct task_struct *tsk) > { > fpsimd_release_task(tsk); > diff --git a/arch/csky/include/asm/processor.h b/arch/csky/include/asm/processor.h > index 9638206bc44f..63ad71fab30d 100644 > --- a/arch/csky/include/asm/processor.h > +++ b/arch/csky/include/asm/processor.h > @@ -69,11 +69,6 @@ do { \ > /* Forward declaration, a strange C thing */ > 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 */ > #define prepare_to_copy(tsk) do { } while (0) > > diff --git a/arch/hexagon/include/asm/processor.h b/arch/hexagon/include/asm/processor.h > index 615f7e49968e..0cd39c2cdf8f 100644 > --- a/arch/hexagon/include/asm/processor.h > +++ b/arch/hexagon/include/asm/processor.h > @@ -60,10 +60,6 @@ struct thread_struct { > #define KSTK_EIP(tsk) (pt_elr(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); > > /* The following stuff is pretty HEXAGON specific. */ > diff --git a/arch/hexagon/kernel/process.c b/arch/hexagon/kernel/process.c > index f0552f98a7ba..e15eeaebd785 100644 > --- a/arch/hexagon/kernel/process.c > +++ b/arch/hexagon/kernel/process.c > @@ -112,13 +112,6 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) > 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 > */ > diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h > index 757c2f6d8d4b..d1978e004054 100644 > --- a/arch/ia64/include/asm/processor.h > +++ b/arch/ia64/include/asm/processor.h > @@ -318,13 +318,6 @@ struct thread_struct { > struct mm_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. */ > extern unsigned long __get_wchan (struct task_struct *p); > > diff --git a/arch/loongarch/include/asm/processor.h b/arch/loongarch/include/asm/processor.h > index 1c4b4308378d..6954dc5d24e9 100644 > --- a/arch/loongarch/include/asm/processor.h > +++ b/arch/loongarch/include/asm/processor.h > @@ -176,9 +176,6 @@ struct thread_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}; > > extern unsigned long boot_option_idle_override; > diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h > index d86b4009880b..7a2da780830b 100644 > --- a/arch/m68k/include/asm/processor.h > +++ b/arch/m68k/include/asm/processor.h > @@ -145,11 +145,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc, > /* Forward declaration, a strange C thing */ > 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); > void show_registers(struct pt_regs *regs); > > diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h > index 7e9e92670df3..4e193c7550df 100644 > --- a/arch/microblaze/include/asm/processor.h > +++ b/arch/microblaze/include/asm/processor.h > @@ -63,11 +63,6 @@ struct thread_struct { > .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); > > /* The size allocated for kernel stacks. This _must_ be a power of two! */ > diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h > index 4bb24579d12e..3fde1ff72bd1 100644 > --- a/arch/mips/include/asm/processor.h > +++ b/arch/mips/include/asm/processor.h > @@ -344,9 +344,6 @@ struct thread_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. > */ > diff --git a/arch/nios2/include/asm/processor.h b/arch/nios2/include/asm/processor.h > index b8125dfbcad2..8916d93d5c2d 100644 > --- a/arch/nios2/include/asm/processor.h > +++ b/arch/nios2/include/asm/processor.h > @@ -64,11 +64,6 @@ extern void start_thread(struct pt_regs *regs, unsigned long pc, > > 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); > > #define task_pt_regs(p) \ > diff --git a/arch/openrisc/include/asm/processor.h b/arch/openrisc/include/asm/processor.h > index aa1699c18add..ed9efb430afa 100644 > --- a/arch/openrisc/include/asm/processor.h > +++ b/arch/openrisc/include/asm/processor.h > @@ -72,7 +72,6 @@ struct thread_struct { > > > 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); > > #define cpu_relax() barrier() > diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c > index 52dc983ddeba..f94b5ec06786 100644 > --- a/arch/openrisc/kernel/process.c > +++ b/arch/openrisc/kernel/process.c > @@ -125,10 +125,6 @@ void show_regs(struct pt_regs *regs) > show_registers(regs); > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Copy the thread-specific (arch specific) info from the current > * process to the new one p > diff --git a/arch/parisc/include/asm/processor.h b/arch/parisc/include/asm/processor.h > index 4621ceb51314..a608970b249a 100644 > --- a/arch/parisc/include/asm/processor.h > +++ b/arch/parisc/include/asm/processor.h > @@ -266,9 +266,6 @@ on downward growing arches, it looks like this: > > 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); > > #define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0]) > diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c > index 7c37e09c92da..3db0e97e6c06 100644 > --- a/arch/parisc/kernel/process.c > +++ b/arch/parisc/kernel/process.c > @@ -146,10 +146,6 @@ void flush_thread(void) > */ > } > > -void release_thread(struct task_struct *dead_task) > -{ > -} > - > /* > * Idle thread support > * > diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h > index fdfaae194ddd..92e332415d02 100644 > --- a/arch/powerpc/include/asm/processor.h > +++ b/arch/powerpc/include/asm/processor.h > @@ -75,7 +75,6 @@ extern int _chrp_type; > > struct task_struct; > 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_CKFPR(i) ckfp_state.fpr[i][TS_FPROFFSET] > diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c > index 0fbda89cd1bb..991cda25b9a9 100644 > --- a/arch/powerpc/kernel/process.c > +++ b/arch/powerpc/kernel/process.c > @@ -1655,11 +1655,6 @@ EXPORT_SYMBOL_GPL(set_thread_tidr); > > #endif /* CONFIG_PPC64 */ > > -void > -release_thread(struct task_struct *t) > -{ > -} > - > /* > * this gets called so that we can store coprocessor state into memory and > * copy the current task into the new thread. > diff --git a/arch/riscv/include/asm/processor.h b/arch/riscv/include/asm/processor.h > index 19eedd4af4cd..94a0590c6971 100644 > --- a/arch/riscv/include/asm/processor.h > +++ b/arch/riscv/include/asm/processor.h > @@ -65,11 +65,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, > extern void start_thread(struct pt_regs *regs, > 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); > > > diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h > index bd66f8e34949..c52fe651eeba 100644 > --- a/arch/s390/include/asm/processor.h > +++ b/arch/s390/include/asm/processor.h > @@ -186,9 +186,6 @@ struct pt_regs; > void show_registers(struct pt_regs *regs); > 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 */ > void guarded_storage_release(struct task_struct *tsk); > void gs_load_bc_cb(struct pt_regs *regs); > diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h > index 45240ec6b85a..27aebf1e75a2 100644 > --- a/arch/sh/include/asm/processor_32.h > +++ b/arch/sh/include/asm/processor_32.h > @@ -127,9 +127,6 @@ struct task_struct; > > 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. > */ > diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c > index a808843375e7..92b6649d4929 100644 > --- a/arch/sh/kernel/process_32.c > +++ b/arch/sh/kernel/process_32.c > @@ -84,11 +84,6 @@ void flush_thread(void) > #endif > } > > -void release_thread(struct task_struct *dead_task) > -{ > - /* do nothing */ > -} > - > asmlinkage void ret_from_fork(void); > asmlinkage void ret_from_kernel_thread(void); > > diff --git a/arch/sparc/include/asm/processor_32.h b/arch/sparc/include/asm/processor_32.h > index b26c35336b51..ba8b70ffec08 100644 > --- a/arch/sparc/include/asm/processor_32.h > +++ b/arch/sparc/include/asm/processor_32.h > @@ -80,9 +80,6 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc, > : "memory"); > } > > -/* Free all resources held by a thread. */ > -#define release_thread(tsk) do { } while(0) > - > unsigned long __get_wchan(struct task_struct *); > > #define task_pt_regs(tsk) ((tsk)->thread.kregs) > diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h > index 89850dff6b03..2667f35d5ea5 100644 > --- a/arch/sparc/include/asm/processor_64.h > +++ b/arch/sparc/include/asm/processor_64.h > @@ -176,9 +176,6 @@ do { \ > regs->tstate &= ~TSTATE_PEF; \ > } while (0) > > -/* Free all resources held by a thread. */ > -#define release_thread(tsk) do { } while (0) > - > unsigned long __get_wchan(struct task_struct *task); > > #define task_pt_regs(tsk) (task_thread_info(tsk)->kregs) > diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h > index d0fc1862da95..bb5f06480da9 100644 > --- a/arch/um/include/asm/processor-generic.h > +++ b/arch/um/include/asm/processor-generic.h > @@ -55,10 +55,6 @@ struct thread_struct { > .request = { 0 } \ > } > > -static inline void release_thread(struct task_struct *task) > -{ > -} > - > /* > * User space process size: 3GB (default). > */ > diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h > index 356308c73951..67c9d73b31fa 100644 > --- a/arch/x86/include/asm/processor.h > +++ b/arch/x86/include/asm/processor.h > @@ -587,9 +587,6 @@ static inline void load_sp0(unsigned long sp0) > > #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); > > /* > diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h > index 76bc63127c66..5abde43c570c 100644 > --- a/arch/xtensa/include/asm/processor.h > +++ b/arch/xtensa/include/asm/processor.h > @@ -221,9 +221,6 @@ struct thread_struct { > struct task_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); > > #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) > diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h > index 81cab4b01edc..d6c48163c6de 100644 > --- a/include/linux/sched/task.h > +++ b/include/linux/sched/task.h > @@ -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); > > +/* Free all architecture-specific resources held by a thread. */ > +void release_thread(struct task_struct *dead_task); > + > #ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT > extern int arch_task_struct_size __read_mostly; > #else > diff --git a/kernel/exit.c b/kernel/exit.c > index 80376b4ac763..30cabf933fed 100644 > --- a/kernel/exit.c > +++ b/kernel/exit.c > @@ -183,6 +183,10 @@ void put_task_struct_rcu_user(struct task_struct *task) > call_rcu(&task->rcu, delayed_put_task_struct); > } > > +void __weak release_thread(struct task_struct *dead_task) > +{ > +} > + > void release_task(struct task_struct *p) > { > struct task_struct *leader; > -- > 2.35.3 > -- Best Regards Guo Ren