Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp527515pxa; Thu, 27 Aug 2020 08:40:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGo12DrxlxsxSsD5U2QNZ/IJuu9af4UMxWUAUy9BUa0Edg+qmsn+ChCPPfcX6krwcCV4Ow X-Received: by 2002:a17:906:c351:: with SMTP id ci17mr13053116ejb.266.1598542800123; Thu, 27 Aug 2020 08:40:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598542800; cv=none; d=google.com; s=arc-20160816; b=JfbF46Gstt2nFP9pTGlpzg58uH5s7k5Mkg3XQNwyXXEfoYkBJPf5cinaZ34H7Lzqsp JAvF/imfCploz0iPNv+qjyHnFYroEf+HSKj7An9877qymV3e3f8LiYM+/XVYlt2//H0m V0F4XxZBj9/pZBiAV8hBAgSp2VhVIXjNmzkM25a/KiwLRTJx01oXIeFh2vKpuQRXJcbB ssskKohOmXxddPdHiGnDeU76HtEilMFEuyIL/sr8DYWDxXwdBN8zVmuesQCdHCG087H+ kzUUclKY0+9uZ70adWNUo+0d1ItZZ8Zn118n1rI0f0DpQA0OYg30s4rOoQSkhzn5lnUz 51SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=IfDwSFZfQYSI+hHvA/d7LTPxRZ/yuy7d8VYvvT1e91k=; b=MFwunsE2gUGG3cKbtYGg2j8CRogFXka40dSUe5xVZuJa9XvzwVXPrviRBelzRnTSok lhImctPpz22PDRI5VTmCjlelo1Hz167CZgFPFHRhwqJDyq2xMMht+0H6F06cjxiUpKiq WatlQzwJM4iOOnuhI+c+ovRc7OoxQ3XBfFjFVmS5jwJ0dk1rHv589ApwtY4VR/0ThNUr KMXYSl2iLPJ7vLTl23gHwzqa6aCzD12pjp5ktu9Yta1fjfgQrRbL7BVY/opWyhzxGCUV +C7Wb9/GMBFHBWcz9L0Hzfp6OZkBSPHzmL5kfLfunbta2Fhlwp/8WIOZp0kLp/fcwCoE dq4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a62si1682924edf.186.2020.08.27.08.39.37; Thu, 27 Aug 2020 08:40:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726845AbgH0PhA (ORCPT + 99 others); Thu, 27 Aug 2020 11:37:00 -0400 Received: from foss.arm.com ([217.140.110.172]:59776 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726009AbgH0PhA (ORCPT ); Thu, 27 Aug 2020 11:37:00 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1511A101E; Thu, 27 Aug 2020 08:36:59 -0700 (PDT) Received: from e120877-lin.cambridge.arm.com (e120877-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EE5DB3F66B; Thu, 27 Aug 2020 08:36:57 -0700 (PDT) From: vincent.donnefort@arm.com To: mingo@redhat.com, peterz@infradead.org, vincent.guittot@linaro.org Cc: linux-kernel@vger.kernel.org, dietmar.eggemann@arm.com, valentin.schneider@arm.com, qais.yousef@arm.com, Vincent Donnefort Subject: [PATCH] sched/debug: Add new tracepoint to track cpu_capacity Date: Thu, 27 Aug 2020 16:35:38 +0100 Message-Id: <1598542538-46278-1-git-send-email-vincent.donnefort@arm.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vincent Donnefort rq->cpu_capacity is a key element in several scheduler parts, such as EAS task placement and load balancing. Tracking this value enables testing and/or debugging by a toolkit. Signed-off-by: Vincent Donnefort diff --git a/include/linux/sched.h b/include/linux/sched.h index 021ad7b..7e19d59 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -2055,6 +2055,7 @@ const struct sched_avg *sched_trace_rq_avg_dl(struct rq *rq); const struct sched_avg *sched_trace_rq_avg_irq(struct rq *rq); int sched_trace_rq_cpu(struct rq *rq); +int sched_trace_rq_cpu_capacity(struct rq *rq); int sched_trace_rq_nr_running(struct rq *rq); const struct cpumask *sched_trace_rd_span(struct root_domain *rd); diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index 8ab48b3..f94ddd1 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -630,6 +630,10 @@ DECLARE_TRACE(pelt_se_tp, TP_PROTO(struct sched_entity *se), TP_ARGS(se)); +DECLARE_TRACE(sched_cpu_capacity_tp, + TP_PROTO(struct rq *rq), + TP_ARGS(rq)); + DECLARE_TRACE(sched_overutilized_tp, TP_PROTO(struct root_domain *rd, bool overutilized), TP_ARGS(rd, overutilized)); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 06b0a40..e468271 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -36,6 +36,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_rt_tp); EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_dl_tp); EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_irq_tp); EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_se_tp); +EXPORT_TRACEPOINT_SYMBOL_GPL(sched_cpu_capacity_tp); EXPORT_TRACEPOINT_SYMBOL_GPL(sched_overutilized_tp); EXPORT_TRACEPOINT_SYMBOL_GPL(sched_util_est_cfs_tp); EXPORT_TRACEPOINT_SYMBOL_GPL(sched_util_est_se_tp); diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 44f7a0b..e11f724 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8116,6 +8116,8 @@ static void update_cpu_capacity(struct sched_domain *sd, int cpu) capacity = 1; cpu_rq(cpu)->cpu_capacity = capacity; + trace_sched_cpu_capacity_tp(cpu_rq(cpu)); + sdg->sgc->capacity = capacity; sdg->sgc->min_capacity = capacity; sdg->sgc->max_capacity = capacity; @@ -11318,6 +11320,12 @@ int sched_trace_rq_cpu(struct rq *rq) } EXPORT_SYMBOL_GPL(sched_trace_rq_cpu); +int sched_trace_rq_cpu_capacity(struct rq *rq) +{ + return rq ? rq->cpu_capacity : -1; +} +EXPORT_SYMBOL_GPL(sched_trace_rq_cpu_capacity); + const struct cpumask *sched_trace_rd_span(struct root_domain *rd) { #ifdef CONFIG_SMP -- 2.7.4