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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F682C7EE2F for ; Fri, 24 Feb 2023 16:50:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230053AbjBXQuW (ORCPT ); Fri, 24 Feb 2023 11:50:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230038AbjBXQuT (ORCPT ); Fri, 24 Feb 2023 11:50:19 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 135753BDA0; Fri, 24 Feb 2023 08:50:15 -0800 (PST) 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 8B10561948; Fri, 24 Feb 2023 16:50:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78DFFC4339B; Fri, 24 Feb 2023 16:50:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1677257415; bh=/+ANatHz1yxjGMA7ryG0c/Km7p/0KZLeF6+BAXFBfTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KNED18r35Unvo+Qk0w/kUt4niIy+qGdq7n1WVYiFX8mYQr2zorPEDVvNDAVDWoe+c 5mZUrQaTmP02Iw8M7rLdZcskZisWBbCmhGDqJYQKbrNztHpK997MnXF4an8vO4KPBS swLEUfOGaLQs5qEDFjkT2Bb+47nGCUFSrLipv8EWdVfUK2Ra7ExpuGMmNetJOHC/nV 5OrL4kgoeJ75Rpk+B7KlR6axpuuMupEUjsSOtu1F9PP16R0BEUDPqotDDrx/ZooKEO V3n6C77MJccDDfp1xu98Gyd/U9hTJJzziFAyXzYtdWsGyUVGKvrR7HqyGzz4SAgkLU j34oE4YW78mgg== From: Josh Poimboeuf To: live-patching@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Seth Forshee , Peter Zijlstra , Song Liu , Mark Rutland , Petr Mladek , Joe Lawrence , Miroslav Benes , Jiri Kosina , Ingo Molnar , Rik van Riel Subject: [PATCH v3 3/3] vhost: Fix livepatch timeouts in vhost_worker() Date: Fri, 24 Feb 2023 08:50:01 -0800 Message-Id: <509f6ea6fe6505f0a75a66026ba531c765ef922f.1677257135.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Livepatch timeouts were reported due to busy vhost_worker() kthreads. Now that cond_resched() can do livepatch task switching, use cond_resched() in vhost_worker(). That's the better way to conditionally call schedule() anyway. Reported-by: Seth Forshee (DigitalOcean) Link: https://lkml.kernel.org/lkml/20230120-vhost-klp-switching-v1-0-7c2b65519c43@kernel.org Tested-by: Seth Forshee (DigitalOcean) Reviewed-by: Petr Mladek Signed-off-by: Josh Poimboeuf --- drivers/vhost/vhost.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 43c9770b86e5..87e3cf12da1c 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -363,8 +363,7 @@ static int vhost_worker(void *data) kcov_remote_start_common(dev->kcov_handle); work->fn(work); kcov_remote_stop(); - if (need_resched()) - schedule(); + cond_resched(); } } kthread_unuse_mm(dev->mm); -- 2.39.1