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=1796382838; b=ephrJ8DSQ+OK7vBei3unaZC8c9CnTds5FVbKN+cySPzJP1Q7Cphf4xN220L0mEyckdRd TMsDnIocKH5ty92ho3/Q+qKUie0pOD10rXlxKb4PwEL3pcUwYW5RfLoi+DjKX6QenmGmN fLQpk/oulFK9HZrq75pK0sAOuk4qjJguTb8Fv/f9ap2IwkB7hFu71egRq2nuCUXJS8hBg PGMGnsafpJ6abNu6KrnN5UJU9mkTfg/JbUz191cRh3Koc1XW4ZYhEcDgY5q9yS7SC3UhO wDrCoxB2+M570jRzcOWEe7FTZTENrTd0GeUS/2W4h8HSEt3+mL+SG9cZvfMa6ItRBLg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382838; 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=9ATHtC+0Bp9atFmN6fVceKOy3c9Qj+W3hnZ9TT6yaxQ=; b=bMs3095dJPO6lPoTz5QOFg8eG3LxKe251paW6dYlhTgtVjlLXbAisq9xAw2juHAOiXVR iHehJ9qnwcPY4VM0Shnf4CumjWb9CsDcGCekeC80WOc6q5ga7X6H8PXelw7CfKpy0Pt/U yvMkY6XRynLaN2PXlUt1PBIVTHGw7WvTfi5qfH/u9ehgwlw3thg9mL0VON3nVwJR2c3/0 sASwcWCHcNIbrDPTDDir/EuLzwieQOPSZB1G/ooZ7js1LuXOkPQCtPhhn5/+oOEbb4hnf uQQ2XGxu+y1puD3TfhBUMLksOc4I9Xop1FMDwHk8oLmEI0iDAZJ253Vqs5rczybUNSA== 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="lqbaw/P9"; 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 AA1E9606A322; Fri, 4 Dec 2026 11:13:58 +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=lqbaw/P9 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B77641F000C2; Fri, 4 Dec 2026 11:13:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382838; bh=9ATHtC+0Bp9atFmN6fVceKOy3c9Qj+W3hnZ9TT6yaxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lqbaw/P92BM4LhUAWXIenuPub7iGjlfnb7yGsN3XuG3NTIJ3cJtZgxbN66vEVQbGr fWuyTACpcTUvlO/NCpiWQ/Ee/KOcUKowB6f9MvyHtTMZB2qaIyU8VixQnsF+iizrNC 08/zGq2wIM7bTFLsW95O1z8pOL87Ol97BGlvKBXc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Shakeel Butt , Aamir Ahmed , Bradley Morgan , "Michael S. Tsirkin" Subject: [PATCH 6.18 617/703] vhost: Run TIF_NOTIFY_RESUME work in the vhost_task loop Date: Fri, 4 Dec 2026 19:08:36 +0900 Message-ID: <20261204100644.195635145@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Aamir Ahmed commit f20d30ff369de1f995546d11888d2b70b089afa4 upstream. Since commit e1fad12dcb66 ("sched/fair: Switch to task based throttle model"), a throttled task is only dequeued when TWA_RESUME task_work runs on its way back to user mode. vhost workers never return to user mode, and vhost_task_fn() only runs task_work via get_signal() when a signal is pending. A busy vhost worker therefore ignores its cgroup's cpu.max, while its runtime is still charged to the group, throttling the group's other tasks (typically the VM's vCPUs) harder. This also fixes memory.high and block cgroup throttling for vhost workers, which are handled in resume_user_mode_work() as well. Run pending notify-resume work at the top of the worker loop, as io-wq does in io_run_task_work(). Commit 12013e3d4695 ("KVM: powerpc: Use generic xfer to guest work function") fixed the same problem for KVM. Fixes: e1fad12dcb66 ("sched/fair: Switch to task based throttle model") Cc: stable@vger.kernel.org # 6.18+ Reviewed-by: Shakeel Butt Tested-by: Shakeel Butt Assisted-by: LLM Signed-off-by: Aamir Ahmed Reviewed-by: Bradley Morgan Signed-off-by: Michael S. Tsirkin Message-ID: Signed-off-by: Greg Kroah-Hartman --- kernel/vhost_task.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/vhost_task.c b/kernel/vhost_task.c index 3717885a5992..f63ac0052149 100644 --- a/kernel/vhost_task.c +++ b/kernel/vhost_task.c @@ -6,6 +6,7 @@ #include #include #include +#include #include enum vhost_task_flags { @@ -31,6 +32,14 @@ static int vhost_task_fn(void *data) for (;;) { bool did_work; + /* + * We never return to user mode, so TWA_RESUME task_work and + * memory.high/blkcg throttling would otherwise never run. Run + * them here, where no locks are held, like io-wq workers do. + */ + if (test_thread_flag(TIF_NOTIFY_RESUME)) + resume_user_mode_work(NULL); + if (signal_pending(current)) { struct ksignal ksig; -- 2.56.1