From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796387352; b=Oebds7GgRZSA9aXm8j4lesjKa0AOdygkFdz6/xXVqnfQ5WP4BWj0xuGRALiv5BEucA8t XT7KgOa2BMDV45LrB3a0Yx32hDR2zjFc7mGeLs6XuShMFhg0Vu2fTScux85K8IcNez6Pi AXVT0JLD7nCnnXvM4ptuxPZH55CaQOI7c48H/C8xPwYlcDiFL9kj1k1wfarlY9oBqJNxD mVeYg3yGOJJHJ7YIt4GBKjWfAo0x9Zvl5Yo8ZJ0PJfl1yjJhG+wuBDiknNOzAnKxo2Yjx 5MpKolE8bF+vQ11eenVQVs9qQYef4w04P4fuI9pbE3ab614S/+6eiw4kOVLQed5xbEA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387352; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=xB0RJdtSYKwxSX1t/Safx5uoYmKRKxRiTg4t5pa/TbY=; b=nf4q8OLd7t6N+hcWvM1h1x4lxmJv4EAEFux1ljseorCBSoxZUApX1fNYjmDs2bmuDKUM hqDL3zTjKemeBrlP5DPp2K5KdC1eSYiyz7/Lg2PaFtbb6aNLRAoRh/E2UvoP+VQfvMyIM iT7PGJT7aqem3FfQYvqIbwQ3TaRy5YV5NrwTf1J6xSLskTJ8+fqIb2GWXO6QP1tbRbksl fwM1k0Qs25U1sQztPVuCeQb7R6T36ns7iG/TOLFqwpVmYDyCFuYBW2ZI21cVAxGneNwwy Ew1s6/T7h2HBNivZYXHFgNU2WFXkQfW2K0Iu44K7t6f0pcmk46jlCyuskUH/rWPDHHw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=gzjQJSyc; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 612E0606A322; Fri, 4 Dec 2026 12:29:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=gzjQJSyc Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBF951F000C2; Fri, 4 Dec 2026 12:29:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387352; bh=xB0RJdtSYKwxSX1t/Safx5uoYmKRKxRiTg4t5pa/TbY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gzjQJSycTz4dUqiB6C2g8T6HQGPRDAAkYFAyJnWz3CmxSBMOnSTg0kEmpdNDIlTCj tk5IRxH35Gw6ZWC50SeyikOLmLvHZoHwZweZ7h1kBbxmsjettWAJy+JJLYd+Tc0oLF FvQa/kRVHVeOLBenbzuTeW1WOWNjT/X+f3PNS3R0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mike Christie , "Michael S. Tsirkin" , "Christian Brauner (Microsoft)" , Sasha Levin Subject: [PATCH 6.1 0209/1059] fork/vm: Move common PF_IO_WORKER behavior to new flag Date: Fri, 4 Dec 2026 18:55:40 +0900 Message-ID: <20261204100649.690135686@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mike Christie [ Upstream commit 54e6842d0775ba76db65cbe21311c3ca466e663d ] This adds a new flag, PF_USER_WORKER, that's used for behavior common to to both PF_IO_WORKER and users like vhost which will use a new helper instead of create_io_thread because they require different behavior for operations like signal handling. The common behavior PF_USER_WORKER covers is the vm reclaim handling. Signed-off-by: Mike Christie Acked-by: Michael S. Tsirkin Signed-off-by: Christian Brauner (Microsoft) Stable-dep-of: cabc249e6560 ("ptrace: refuse to change the signal mask of a user worker") Signed-off-by: Sasha Levin --- include/linux/sched.h | 2 +- include/linux/sched/task.h | 1 + kernel/fork.c | 3 +++ mm/vmscan.c | 4 ++-- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 50fd0b4e7dd9e..38920e9c1a2ae 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1743,7 +1743,7 @@ extern struct pid __rcu *cad_pid; #define PF_MEMALLOC 0x00000800 /* Allocating memory */ #define PF_NPROC_EXCEEDED 0x00001000 /* set_user() noticed that RLIMIT_NPROC was exceeded */ #define PF_USED_MATH 0x00002000 /* If unset the fpu must be initialized before use */ -#define PF__HOLE__00004000 0x00004000 +#define PF_USER_WORKER 0x00004000 /* Kernel thread cloned from userspace thread */ #define PF_NOFREEZE 0x00008000 /* This thread should not be frozen */ #define PF__HOLE__00010000 0x00010000 #define PF_KSWAPD 0x00020000 /* I am kswapd */ diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h index 67ea05da511dc..209eac4841f73 100644 --- a/include/linux/sched/task.h +++ b/include/linux/sched/task.h @@ -26,6 +26,7 @@ struct kernel_clone_args { int exit_signal; u32 kthread:1; u32 io_thread:1; + u32 user_worker:1; unsigned long stack; unsigned long stack_size; unsigned long tls; diff --git a/kernel/fork.c b/kernel/fork.c index 411c2b427ea85..e1bab170045b3 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -2200,6 +2200,8 @@ static __latent_entropy struct task_struct *copy_process( p->flags &= ~PF_KTHREAD; if (args->kthread) p->flags |= PF_KTHREAD; + if (args->user_worker) + p->flags |= PF_USER_WORKER; if (args->io_thread) { /* * Mark us an IO worker, and block any signal that isn't @@ -2713,6 +2715,7 @@ struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int node) .fn = fn, .fn_arg = arg, .io_thread = 1, + .user_worker = 1, }; /* A creator past its fatal signal or its coredump point gets no thread. */ diff --git a/mm/vmscan.c b/mm/vmscan.c index 86a7bc87f55d9..da105247467e2 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1130,12 +1130,12 @@ void reclaim_throttle(pg_data_t *pgdat, enum vmscan_throttle_state reason) DEFINE_WAIT(wait); /* - * Do not throttle IO workers, kthreads other than kswapd or + * Do not throttle user workers, kthreads other than kswapd or * workqueues. They may be required for reclaim to make * forward progress (e.g. journalling workqueues or kthreads). */ if (!current_is_kswapd() && - current->flags & (PF_IO_WORKER|PF_KTHREAD)) { + current->flags & (PF_USER_WORKER|PF_KTHREAD)) { cond_resched(); return; } -- 2.53.0