From patchwork Fri Jun 26 08:36:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sexton, Rory" X-Patchwork-Id: 72227 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3C71CA0350; Fri, 26 Jun 2020 10:56:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 183191BE90; Fri, 26 Jun 2020 10:56:40 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 4FF851BE81 for ; Fri, 26 Jun 2020 10:56:38 +0200 (CEST) IronPort-SDR: nKLaPQstRXPtcJs8gNbuHMcgZ4DdmKx7WNcI+8zAY9v7xULSXlKy6D2ZNlQkVtWLvuz85HJZ5P gNw5zDsQPQdg== X-IronPort-AV: E=McAfee;i="6000,8403,9663"; a="163306615" X-IronPort-AV: E=Sophos;i="5.75,283,1589266800"; d="scan'208";a="163306615" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2020 01:56:37 -0700 IronPort-SDR: HpVSDd7H1oYHQhOb0a+F3qr8oweu+AdpybjRHWa9wKOwmeS5lLeG/2xJj0nUBdt6sGZHdzeZzG aT6MElMe6RfA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,283,1589266800"; d="scan'208";a="280091896" Received: from silpixa00399913.ir.intel.com (HELO silpixa00399913.ger.corp.intel.com) ([10.237.222.230]) by orsmga006.jf.intel.com with ESMTP; 26 Jun 2020 01:56:36 -0700 From: "Sexton, Rory" To: dev@dpdk.org, david.hunt@intel.com Cc: "Sexton, Rory" Date: Fri, 26 Jun 2020 09:36:57 +0100 Message-Id: <20200626083658.35843-2-rory.sexton@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200626083658.35843-1-rory.sexton@intel.com> References: <20200626083658.35843-1-rory.sexton@intel.com> Subject: [dpdk-dev] [v2 2/3] examples/vm_power_manager: Allowing power managing of idle cores X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This change is required to allow the branch ratio algorithm to power manage cores with no workload running on them. This is useful both when idle cores don't use C-states and for a number of hyperthreading scenarios. Signed-off-by: Rory Sexton Reviewed-by: David Hunt --- examples/vm_power_manager/oob_monitor_x86.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/vm_power_manager/oob_monitor_x86.c b/examples/vm_power_manager/oob_monitor_x86.c index 3c514475f..a5b1c168c 100644 --- a/examples/vm_power_manager/oob_monitor_x86.c +++ b/examples/vm_power_manager/oob_monitor_x86.c @@ -96,12 +96,12 @@ apply_policy(int core) g_branch_misses = miss_diff; if (hits_diff < (INTERVAL*100)) { - /* Likely no workload running on this core. Skip. */ - return -1.0; + /* Likely no workload running on this core. */ + ratio = 0.0; + } else { + ratio = (float)miss_diff * (float)100 / (float)hits_diff; } - ratio = (float)miss_diff * (float)100 / (float)hits_diff; - /* * Store the last few directions that the ratio indicates * we should take. If there's on 'up', then we scale up