From patchwork Fri Oct 21 10:39:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 13014584 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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 241C4C4332F for ; Fri, 21 Oct 2022 10:39:59 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.427570.676769 (Exim 4.92) (envelope-from ) id 1olpRN-0006zc-UE; Fri, 21 Oct 2022 10:39:49 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 427570.676769; Fri, 21 Oct 2022 10:39:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1olpRN-0006zV-Py; Fri, 21 Oct 2022 10:39:49 +0000 Received: by outflank-mailman (input) for mailman id 427570; Fri, 21 Oct 2022 10:39:48 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1olpRM-0006zN-H5 for xen-devel@lists.xenproject.org; Fri, 21 Oct 2022 10:39:48 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id aefc994f-512c-11ed-91b5-6bf2151ebd3b; Fri, 21 Oct 2022 12:39:47 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3D00F222E0; Fri, 21 Oct 2022 10:39:47 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 02E2B1331A; Fri, 21 Oct 2022 10:39:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id IEXQOfJ2UmOQIgAAMHmgww (envelope-from ); Fri, 21 Oct 2022 10:39:46 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: aefc994f-512c-11ed-91b5-6bf2151ebd3b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1666348787; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=SxgbxSMyb0IFJGx0g8YtqshvcZalAQw+dJK/WArNEog=; b=txepUFtSN5gyKNLYR8SWIaXWBdY49vmiII+MfWBoopNd8Y2zNTTyFUfW2GHxYIJq3csZx6 WzW4YPCVzZbOS73PXpu0P0oLBDSmi95iaLP0UDCOG8I3VUVO1a9RMepIgAPeLkBkymXRty FUOnlsXDfjFMF+oCpDAhVjlrzTHNmwM= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Dario Faggioli , Meng Xu , George Dunlap Subject: [PATCH] xen/sched: try harder to find a runnable unit in rt_schedule() Date: Fri, 21 Oct 2022 12:39:45 +0200 Message-Id: <20221021103945.4416-1-jgross@suse.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Instead of directly falling back to the idle unit in case the top unit from the run queue happened to be not runnable, consult the run queue again. Suggested-by: Dario Faggioli Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- xen/common/sched/rt.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/xen/common/sched/rt.c b/xen/common/sched/rt.c index 960a8033e2..1f8d074884 100644 --- a/xen/common/sched/rt.c +++ b/xen/common/sched/rt.c @@ -1080,15 +1080,20 @@ rt_schedule(const struct scheduler *ops, struct sched_unit *currunit, } else { - snext = runq_pick(ops, cpumask_of(sched_cpu), cur_cpu); - - if ( snext == NULL ) - snext = rt_unit(sched_idle_unit(sched_cpu)); - else if ( !unit_runnable_state(snext->unit) ) + while ( true ) { + snext = runq_pick(ops, cpumask_of(sched_cpu), cur_cpu); + + if ( snext == NULL ) + { + snext = rt_unit(sched_idle_unit(sched_cpu)); + break; + } + if ( unit_runnable_state(snext->unit) ) + break; + q_remove(snext); replq_remove(ops, snext); - snext = rt_unit(sched_idle_unit(sched_cpu)); } /* if scurr has higher priority and budget, still pick scurr */