From nobody Mon Nov 23 22:35:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1790371810; cv=none; d=zohomail.com; s=zohoarc; b=Enf9FXoPGZIenRaQFjExmRHO0o4N2BjVWaNqlTv53uyY+uC3pCzvNjyDe0DhETQXvpOhiomxxhLT7tW35ZBT4+Tue0zDCND+1QzFJkTN2LQt9EjwAGJN4u0Q6SPFBEpUIcVNdpPUuKDq8xI6A/ocOMmUkVHBMfCOtKuhGMGkw14= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790371810; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7QucN9a3s6YOZ/pZqC92p6YUYcOmeCZBjPTIIo9ChcI=; b=YqbIfFu5Wm+33X1FMJU/MZ/UcJxTnvUeP2uWQWr5zAzNxf8r/HzJbrEQli5I2GfL0aH7fJLa4yOGoyLkzeh0BBaXvcz/6K1hzTJZVK+e6CR77rftL/XTO5uZC9BUbeRLd7nekplnsPT3xq3jkw/0JTuxFxUZ1ZSIZ19hkE7Qcjg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1790371809997551.1893330258288; Fri, 25 Sep 2026 14:30:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1434510.1654390 (Exim 4.92) (envelope-from ) id 1xADU5-0006Xu-L8; Fri, 25 Sep 2026 21:29:33 +0000 Received: by outflank-mailman (output) from mailman id 1434510.1654390; Fri, 25 Sep 2026 21:29:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xADU5-0006Xm-Hz; Fri, 25 Sep 2026 21:29:33 +0000 Received: by outflank-mailman (input) for mailman id 1434510; Fri, 25 Sep 2026 21:29:33 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xADU4-0006Xg-Vg for xen-devel@lists.xenproject.org; Fri, 25 Sep 2026 21:29:33 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xADU4-00FXOq-Cb for xen-devel@lists.xenproject.org; Fri, 25 Sep 2026 23:29:32 +0200 Received: from [10.42.69.2] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6ab6e71a-bab6-0a2a0a5309dd-0a2a4502c94c-20 for ; Fri, 25 Sep 2026 23:29:32 +0200 Received: from [74.125.228.170] (helo=mail-ej2-f42.google.com) by tlsNG-720697.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6ab6e7bc-6ca4-0a2a45020019-4a7de4aaa836-3 for ; Fri, 25 Sep 2026 23:29:32 +0200 Received: by mail-ej2-f42.google.com with SMTP id a640c23a62f3a-c2da4eea067so5006566b.3 for ; Fri, 25 Sep 2026 14:29:32 -0700 (PDT) Received: from thinkpad-t470s.. (93-143-38-88.adsl.net.t-com.hr. [93.143.38.88]) by smtp.googlemail.com with ESMTPSA id a640c23a62f3a-c2ae757ac8dsm172582266b.25.2026.09.25.14.29.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Sep 2026 14:29:30 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790371772; x=1790976572; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=7QucN9a3s6YOZ/pZqC92p6YUYcOmeCZBjPTIIo9ChcI=; b=oSEuzGYLBpnzogzKfgDq5IcYxNma71hoL0scWvxT//c0v79b8zyh3RPN9ypo7NlT/j 6Dfmhv/HdWikn5DQb3vdgFKLEF6iSv9SOecBJ7pKCx4RghA+LOmeRCYdoaRJHc3LjgPj dvrRGaSyLm18LQHuQgIdpvLgD8t26i0IhJ+pr9uQ/Zpk40QO0MToPU7O/T5q+Mly6oSa VmSZmjR54AEKjWGIkOpqEOk4ljuB3UKYAt4aBU0Y0ih6zLzOt78ZowvKn88HjEfYjNLi i1j/DbJxc4pTSCSY4DegdZaMovxczFfLRLYDepT3lo/Eo//J5TMBfN+KO5o63161LZXy 1YYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790371772; x=1790976572; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=7QucN9a3s6YOZ/pZqC92p6YUYcOmeCZBjPTIIo9ChcI=; b=Y7KKxll6Et1rS79X20vy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id a640c23a62f3a-c2af571420cmr198424966b.20.1790371771687; Fri, 25 Sep 2026 14:29:31 -0700 (PDT) From: Ruslan Ruslichenko To: xen-devel@lists.xenproject.org Cc: dfaggioli@suse.com, jgross@suse.com, gwd@xenproject.org, artem_mygaiev@epam.com, Ruslan_Ruslichenko@epam.com Subject: [PATCH] xen/sched: refactor urgent count update Date: Fri, 25 Sep 2026 23:28:03 +0200 Message-ID: <20260925212803.799550-1-ruslichenko.r@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-720697/1790371772-664B62AC-64B91BAE/0/0 X-purgate-type: clean X-purgate-size: 2311 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1790371812624158500 Content-Type: text/plain; charset="utf-8" From: Ruslan Ruslichenko With current implementation whenever vCPU blocks on waiting for event channel via SCHEDOP_poll hypercall, scheduler sets 'is_urgent' flag. The flag is cleared on vCPU runstate change, if it is no longer in 'VPF_blocked' state or its vcpu_id is not in poll_mask. However, the only way for vCPU runstate to change in polled state is when it's going to wakeup. Thus when 'is_urgent' is set, inner condition will always be: if ( unlikely(v->is_urgent) ) { if ( !(v->pause_flags & VPF_blocked) || // Always True !test_bit(v->vcpu_id, v->domain->poll_mask) ) // Never evaluated This makes the second condition dead code. Thus simplify overall code structure and remove dead code. The patch has no functional change. Signed-off-by: Ruslan Ruslichenko --- xen/common/sched/core.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 77cbfd5226..22b3cd1007 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -241,26 +241,22 @@ static inline void trace_continue_running(const struc= t vcpu *v) =20 static inline void vcpu_urgent_count_update(struct vcpu *v) { + bool cur_urgent; + if ( is_idle_vcpu(v) ) return; =20 - if ( unlikely(v->is_urgent) ) - { - if ( !(v->pause_flags & VPF_blocked) || - !test_bit(v->vcpu_id, v->domain->poll_mask) ) - { - v->is_urgent =3D 0; - atomic_dec(&per_cpu(sched_urgent_count, v->processor)); - } - } - else + cur_urgent =3D (v->pause_flags & VPF_blocked) && + test_bit(v->vcpu_id, v->domain->poll_mask); + + if ( unlikely(v->is_urgent !=3D cur_urgent) ) { - if ( unlikely(v->pause_flags & VPF_blocked) && - unlikely(test_bit(v->vcpu_id, v->domain->poll_mask)) ) - { - v->is_urgent =3D 1; + v->is_urgent =3D cur_urgent; + + if ( cur_urgent ) atomic_inc(&per_cpu(sched_urgent_count, v->processor)); - } + else + atomic_dec(&per_cpu(sched_urgent_count, v->processor)); } } =20 --=20 2.43.0