Commit 5b0c03b1 authored by Jens Axboe's avatar Jens Axboe Committed by Li Lingfeng
Browse files

arch: setup PF_IO_WORKER threads like PF_KTHREAD

stable inclusion
from stable-v5.10.162
commit 320c8057eceb18c5d836fcbe0ffb0035fcfe28ff
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6LQMS

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=320c8057eceb18c5d836fcbe0ffb0035fcfe28ff



--------------------------------

PF_IO_WORKER are kernel threads too, but they aren't PF_KTHREAD in the
sense that we don't assign ->set_child_tid with our own structure. Just
ensure that every arch sets up the PF_IO_WORKER threads like kthreads
in the arch implementation of copy_thread().

Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>

Conflict:
  arch/s390/kernel/process.c
  arch/x86/kernel/process.c
Signed-off-by: default avatarLi Lingfeng <lilingfeng3@huawei.com>
parent 7bfe5365
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -249,7 +249,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
	childti->pcb.ksp = (unsigned long) childstack;
	childti->pcb.flags = 1;	/* set FEN, clear everything else */

	if (unlikely(p->flags & PF_KTHREAD)) {
	if (unlikely(p->flags & (PF_KTHREAD | PF_IO_WORKER))) {
		/* kernel thread */
		memset(childstack, 0,
			sizeof(struct switch_stack) + sizeof(struct pt_regs));
+1 −1
Original line number Diff line number Diff line
@@ -191,7 +191,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
	childksp[0] = 0;			/* fp */
	childksp[1] = (unsigned long)ret_from_fork; /* blink */

	if (unlikely(p->flags & PF_KTHREAD)) {
	if (unlikely(p->flags & (PF_KTHREAD | PF_IO_WORKER))) {
		memset(c_regs, 0, sizeof(struct pt_regs));

		c_callee->r13 = kthread_arg;
+1 −1
Original line number Diff line number Diff line
@@ -243,7 +243,7 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start,
	thread->cpu_domain = get_domain();
#endif

	if (likely(!(p->flags & PF_KTHREAD))) {
	if (likely(!(p->flags & (PF_KTHREAD | PF_IO_WORKER)))) {
		*childregs = *current_pt_regs();
		childregs->ARM_r0 = 0;
		if (stack_start)
+1 −1
Original line number Diff line number Diff line
@@ -405,7 +405,7 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start,

	ptrauth_thread_init_kernel(p);

	if (likely(!(p->flags & PF_KTHREAD))) {
	if (likely(!(p->flags & (PF_KTHREAD | PF_IO_WORKER)))) {
		*childregs = *current_pt_regs();
		childregs->regs[0] = 0;

+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ int copy_thread(unsigned long clone_flags,
	/* setup thread.sp for switch_to !!! */
	p->thread.sp = (unsigned long)childstack;

	if (unlikely(p->flags & PF_KTHREAD)) {
	if (unlikely(p->flags & (PF_KTHREAD | PF_IO_WORKER))) {
		memset(childregs, 0, sizeof(struct pt_regs));
		childstack->r15 = (unsigned long) ret_from_kernel_thread;
		childstack->r10 = kthread_arg;
Loading