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=1796381404; b=ThaCtc5C7wAUiz6n3+jYXA0CYfy/ZQKhCFfQf8SfFFMKv9H7WTW06APwk1/Z4cOW0nR3 XIbghFSqsAcnjoZXwvqTXHR8ZY/bwM4xxpaXS8UroYr1DR3ggmbMUyw1LWQMnfCy015U3 YRqwt1j5Tk1IKcmAs2iji5QcOUb2XnoF23UVK7X+xtbhPdj20O/CcRCQnv9hZk3UnrcSo P3zZREqzvB+dOAgdSTgkq0Ogi2s6TuAOBk35v/zAummGoaw5jzOKlUdZ8Pc5ceHxzOezb YbUzTmrTluy/EhJvBDudlY6c7zk+qF3HNe3XGzQd6vzQ5iEdinCep/vss+DWiCfII0Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381404; 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=q5/R3y1J6pjErGJtGMCq6+fXpDe12CI0nrhB2IM+N4Q=; b=oWzPXXrArXclZEV9gSI8C0l3ns4ZDgFuBnt9jAt+iF/E0Siw0BFBjWc3jIvLnzxAtBTp 2A3GAm/eA9ftIkGk3Ns9mb0ICJcZmtFh3TT4HtsWAf2s3UeCfgvGdpxkAj4b/OP6ZnH2K /UUa9JWExRI0+NbPVzze2nDWqXpQfzvM+Nn5ISg5+8TEYFHehEhyc2E0BlZ+mcl0n7C2R fZ1PQ+rjq6rTUhnQkjvR5BVqao2EGgAH2j74loRJ88zxdZa44WjcTnfKnbb4m+SslVW1a btL/1MOCJUcRWmHfI8CVL/UAX+zv4oVeEUy/IHMoMQAZknzmHucTf2SupnMaF0DgKRQ== 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=FhE5heAw; 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 38E58606A32C; Fri, 4 Dec 2026 10:50:04 +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=FhE5heAw Received: by smtp.kernel.org (Postfix) with ESMTPSA id A36E71F00935; Fri, 4 Dec 2026 10:50:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381404; bh=q5/R3y1J6pjErGJtGMCq6+fXpDe12CI0nrhB2IM+N4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FhE5heAwlktRW4nLIFwdG5b4V8y8Wdu9qjavT1Bh9o4i+ZLRmA4o8N3vR4GCohu5e IB7DYaltd5URXVwhGaPKvchvqB+lZusJ3eLD1/1Fdfcvo8l4+iuYi1/Nofq+smK+1g WhS3hTEqDDMZ70LZ9KWVf+ogoVcFZ6w4duI9UuJc= 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 7.3 688/742] vhost: Run TIF_NOTIFY_RESUME work in the vhost_task loop Date: Fri, 4 Dec 2026 19:09:12 +0900 Message-ID: <20261204100653.328251525@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-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(+) --- 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;