Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752256AbdGDMbd (ORCPT ); Tue, 4 Jul 2017 08:31:33 -0400 Received: from mail-wr0-f181.google.com ([209.85.128.181]:34091 "EHLO mail-wr0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752162AbdGDMbb (ORCPT ); Tue, 4 Jul 2017 08:31:31 -0400 From: Claudio Scordino To: linux-kernel@vger.kernel.org Cc: peterz@infradead.org, mingo@redhat.com, Claudio Scordino , Juri Lelli , Luca Abeni Subject: [PATCH] sched/deadline: add GRUB bw change tracepoints Date: Tue, 4 Jul 2017 14:29:56 +0200 Message-Id: <1499171396-9662-1-git-send-email-claudio@evidence.eu.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3060 Lines: 106 This patch adds a tracepoint for tracing the total and running bandwidths of GRUB's runqueue. Signed-off-by: Claudio Scordino Signed-off-by: Juri Lelli Signed-off-by: Luca Abeni --- include/trace/events/sched.h | 32 ++++++++++++++++++++++++++++++++ kernel/sched/deadline.c | 11 +++++++++++ 2 files changed, 43 insertions(+) diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index ae1409f..050fcb2 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -545,6 +545,38 @@ TRACE_EVENT(sched_swap_numa, __entry->dst_cpu, __entry->dst_nid) ); +DECLARE_EVENT_CLASS(sched_dl_grub_template, + + TP_PROTO(u64 this_bw, u64 running_bw, unsigned int cpu_id), + + TP_ARGS(this_bw, running_bw, cpu_id), + + TP_STRUCT__entry( + __field(u64, this_bw) + __field(u64, running_bw) + __field(u32, cpu_id) + ), + + TP_fast_assign( + __entry->this_bw = this_bw; + __entry->running_bw = running_bw; + __entry->cpu_id = cpu_id; + ), + + TP_printk("total_bw=%llu running_bw=%llu cpu_id=%lu", + (unsigned long long)__entry->this_bw, + (unsigned long long)__entry->running_bw, + (unsigned long)__entry->cpu_id) +); + + +DEFINE_EVENT(sched_dl_grub_template, sched_dl_grub, + + TP_PROTO(u64 this_bw, u64 running_bw, unsigned int cpu_id), + + TP_ARGS(this_bw, running_bw, cpu_id) +); + /* * Tracepoint for waking a polling cpu without an IPI. */ diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index a84299f..ae5c7ef 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -17,6 +17,7 @@ #include "sched.h" #include +#include #include struct dl_bandwidth def_dl_bandwidth; @@ -85,6 +86,8 @@ void add_running_bw(u64 dl_bw, struct dl_rq *dl_rq) dl_rq->running_bw += dl_bw; SCHED_WARN_ON(dl_rq->running_bw < old); /* overflow */ SCHED_WARN_ON(dl_rq->running_bw > dl_rq->this_bw); + trace_sched_dl_grub(dl_rq->this_bw, dl_rq->running_bw, + rq_of_dl_rq(dl_rq)->cpu); } static inline @@ -97,6 +100,8 @@ void sub_running_bw(u64 dl_bw, struct dl_rq *dl_rq) SCHED_WARN_ON(dl_rq->running_bw > old); /* underflow */ if (dl_rq->running_bw > old) dl_rq->running_bw = 0; + trace_sched_dl_grub(dl_rq->this_bw, dl_rq->running_bw, + rq_of_dl_rq(dl_rq)->cpu); } static inline @@ -107,6 +112,9 @@ void add_rq_bw(u64 dl_bw, struct dl_rq *dl_rq) lockdep_assert_held(&(rq_of_dl_rq(dl_rq))->lock); dl_rq->this_bw += dl_bw; SCHED_WARN_ON(dl_rq->this_bw < old); /* overflow */ + trace_sched_dl_grub(dl_rq->this_bw, dl_rq->running_bw, + rq_of_dl_rq(dl_rq)->cpu); + } static inline @@ -120,6 +128,9 @@ void sub_rq_bw(u64 dl_bw, struct dl_rq *dl_rq) if (dl_rq->this_bw > old) dl_rq->this_bw = 0; SCHED_WARN_ON(dl_rq->running_bw > dl_rq->this_bw); + trace_sched_dl_grub(dl_rq->this_bw, dl_rq->running_bw, + rq_of_dl_rq(dl_rq)->cpu); + } void dl_change_utilization(struct task_struct *p, u64 new_bw) -- 2.7.4