From nobody Mon Apr 29 10:30:42 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1559225863; cv=none; d=zoho.com; s=zohoarc; b=RN8vmih5zp4AvcLLHFeJyY6blcr75hEX15qGdaJlo7qaBNMX1CWe/kRKj1yLSLwD6g7s+hAtXMXX0L3W4AWQ6ZoPntDgc1g+ZD8wG+eDeGIVvnGmHCubbC59aEulM6sIUXN+3R6B93xDa5IFeqVkeK/Hfi4UOCKg7IvhAHOZBrw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559225863; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=253gPv/h+5BMH5DTwQgHAduFBSsQlNHCR4hcB7sHzzw=; b=PeOU127Ill5VjWikh6bEI2kaRNHrvu8z9+MQg8mwKSZgLbnOlHRTm72/kwC4Uq+091mRgu8VlRjcIuTM288D4Juv0fu7qwvafVwFzAJ9XJo6e0sHCXDKB6LgJnZ5FBhBdwBF+Xin6ZFWHfUqomP2AWcRVkf3Mqpbm1mEfpqaHTk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 155922586379137.997636914721625; Thu, 30 May 2019 07:17:43 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hWLqd-00030Q-LT; Thu, 30 May 2019 14:16:03 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hWLqc-00030L-N6 for xen-devel@lists.xenproject.org; Thu, 30 May 2019 14:16:02 +0000 Received: from mail-lf1-x144.google.com (unknown [2a00:1450:4864:20::144]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 730d10c4-82e5-11e9-8980-bc764e045a96; Thu, 30 May 2019 14:16:01 +0000 (UTC) Received: by mail-lf1-x144.google.com with SMTP id v18so5175341lfi.1 for ; Thu, 30 May 2019 07:16:00 -0700 (PDT) Received: from aanisov-work.kyiv.epam.com (ll-22.209.223.85.sovam.net.ua. [85.223.209.22]) by smtp.gmail.com with ESMTPSA id t12sm510421ljj.26.2019.05.30.07.15.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 May 2019 07:15:58 -0700 (PDT) X-Inumbo-ID: 730d10c4-82e5-11e9-8980-bc764e045a96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=R+hWfhfjLGc6cIXN+1+ICw4PJaOdo+xOmr686zjaPjc=; b=OgydflC1sFMk/W/pi+nb3o0O0FiDet8gmUHu8d2ZmhjQyc02pF3MUqlhBFdnDpTZKo sEqAFH9TWX2i7IduK5CUdnrwdgC91yGDvLkkc4nmtBJEEmt89hUhvQ3iGhqp8QSlEcdG qXFS6OOfXppHQBZTVH6c32htZ6JRhXNa88tP/Ufr2nwnAeea+GVHk43e1+XR1Y+gJl5u cBokTaavngjroziaJhEtibxUb6MBW13D5kPt2FmJyAUgGXUPqcTD/BhJ/73Ko5cjbxY9 A/pUoGB5tDHg+4MuJZopwylBEmD99nZ7GVvkIy5CyHDP07EC4eQoKH+bnZIkfolPaDAm 1Mkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=R+hWfhfjLGc6cIXN+1+ICw4PJaOdo+xOmr686zjaPjc=; b=kdsMll3KP2rwOZBVLbM2UEk3of+W3b/bnhIBpzYx+GCnGhZa+P/Lc4eA/HEfNozAXQ XpyyQufKef03tzuVWCPCaImNQqjPf4r/tntJqyTQ0I+wXvjb2yPt8hzRhiOdob/4US/e OAvkNC5KjM105/nb/uDPLmUDb4ypFRBkMV0XZkchJIVGqifhaMSbVxNtWqwdMTOTor1c +MKHrUZmK0rTruNmjMWGLEwGhbKiqnomuYZ1t4gRfZhrRBmbKSVnF5aTXHr613x+GGjR vr8ilMS3V15BzgIElhVKNMjWFhn46GBe7ECwV9phkH20rcCjbbZddrp2kB0oBEsQOe1+ 41FQ== X-Gm-Message-State: APjAAAWw8/QWm1R0HsbC9Jg+42KmKv9n65fawwhcMktWJp//gYhZrtpe ksMcTrlIgzrV0ToWJS+KMzfyW0gG98kg/A== X-Google-Smtp-Source: APXvYqwhZCMBIG8mPHAtMGsugHX/VZDwypUTXbO4zTg/uiWjxwp+aKZhDu2YnaWfbk7q/HDo6TYQ8A== X-Received: by 2002:ac2:4156:: with SMTP id c22mr2264084lfi.12.1559225759101; Thu, 30 May 2019 07:15:59 -0700 (PDT) From: Andrii Anisov To: xen-devel@lists.xenproject.org Date: Thu, 30 May 2019 17:15:51 +0300 Message-Id: <1559225751-30736-1-git-send-email-andrii.anisov@gmail.com> X-Mailer: git-send-email 2.7.4 Subject: [Xen-devel] [PATCH v3] schedule: move last_run_time to the credit scheduler privates X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Tim Deegan , Stefano Stabellini , Andrii Anisov , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Dario Faggioli , Julien Grall , Jan Beulich MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Andrii Anisov The structure member last_run_time is used by credit scheduler only. So move it from a generic vcpu structure to the credit scheduler private vcpu definition. With this move we have slight changes in functionality: - last_run_time is not updated for an idle vcpu. But the idle vcpu is, in fact, a per-pcpu stub and never migrates so last_run_time is meaningless for it. - The value of last_run_time is updated on every schedule, even if the vcpu is not being changed. It is still ok, because last_run_time is only used for runnable vcpu migration decision, and we have it correct at that moment. Scheduling parameters and statistics are tracked by other entities. While here, also: - turn last_run_time into s_time_t, which is more appropriate. - properly const-ify related argument of __csched_vcpu_is_cache_hot(). Signed-off-by: Andrii Anisov --- Changes in v3: - commit message updated accordingly to [1] v2: - last_run_time type changed to s_time_t - scurr changed to svc - dropped stray blanks - pointers to const are used appropriately [1] https://lists.xenproject.org/archives/html/xen-devel/2018-09/msg01201.h= tml --- xen/common/sched_credit.c | 12 +++++++++--- xen/common/schedule.c | 1 - xen/include/xen/sched.h | 3 --- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index 7b7facb..b097048 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -175,6 +175,9 @@ struct csched_vcpu { atomic_t credit; unsigned int residual; =20 + /* last time when vCPU is scheduled out */ + s_time_t last_run_time; + #ifdef CSCHED_STATS struct { int credit_last; @@ -701,10 +704,11 @@ static unsigned int vcpu_migration_delay_us; integer_param("vcpu_migration_delay", vcpu_migration_delay_us); =20 static inline bool -__csched_vcpu_is_cache_hot(const struct csched_private *prv, struct vcpu *= v) +__csched_vcpu_is_cache_hot(const struct csched_private *prv, + const struct csched_vcpu *svc) { bool hot =3D prv->vcpu_migr_delay && - (NOW() - v->last_run_time) < prv->vcpu_migr_delay; + (NOW() - svc->last_run_time) < prv->vcpu_migr_delay; =20 if ( hot ) SCHED_STAT_CRANK(vcpu_hot); @@ -716,6 +720,7 @@ static inline int __csched_vcpu_is_migrateable(const struct csched_private *prv, struct vcpu= *vc, int dest_cpu, cpumask_t *mask) { + const struct csched_vcpu *svc =3D CSCHED_VCPU(vc); /* * Don't pick up work that's hot on peer PCPU, or that can't (or * would prefer not to) run on cpu. @@ -725,7 +730,7 @@ __csched_vcpu_is_migrateable(const struct csched_privat= e *prv, struct vcpu *vc, */ ASSERT(!vc->is_running); =20 - return !__csched_vcpu_is_cache_hot(prv, vc) && + return !__csched_vcpu_is_cache_hot(prv, svc) && cpumask_test_cpu(dest_cpu, mask); } =20 @@ -1870,6 +1875,7 @@ csched_schedule( /* Update credits of a non-idle VCPU. */ burn_credits(scurr, now); scurr->start_time -=3D now; + scurr->last_run_time =3D now; } else { diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 66f1e26..4deacf6 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -1493,7 +1493,6 @@ static void schedule(void) ((prev->pause_flags & VPF_blocked) ? RUNSTATE_blocked : (vcpu_runnable(prev) ? RUNSTATE_runnable : RUNSTATE_offline)), now); - prev->last_run_time =3D now; =20 ASSERT(next->runstate.state !=3D RUNSTATE_running); vcpu_runstate_change(next, RUNSTATE_running, now); diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 2201fac..7aa0be6 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -174,9 +174,6 @@ struct vcpu } runstate_guest; /* guest address */ #endif =20 - /* last time when vCPU is scheduled out */ - uint64_t last_run_time; - /* Has the FPU been initialised? */ bool fpu_initialised; /* Has the FPU been used since it was last saved? */ --=20 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel