From patchwork Thu Jan 14 15:24:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Abeni X-Patchwork-Id: 59745 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp4079397lbb; Thu, 14 Jan 2016 07:25:56 -0800 (PST) X-Received: by 10.98.76.149 with SMTP id e21mr6776755pfj.89.1452785156770; Thu, 14 Jan 2016 07:25:56 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q10si311021pfq.39.2016.01.14.07.25.56; Thu, 14 Jan 2016 07:25:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@unitn-it.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755538AbcANPZp (ORCPT + 29 others); Thu, 14 Jan 2016 10:25:45 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:33188 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755354AbcANPZl (ORCPT ); Thu, 14 Jan 2016 10:25:41 -0500 Received: by mail-wm0-f42.google.com with SMTP id f206so351853231wmf.0 for ; Thu, 14 Jan 2016 07:25:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unitn-it.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SOrdd4XI8slusQze/yS7iFEJWMkT40vmJMm81KqtMYM=; b=eyQNdrn/N4tVgqUupnRo6CEV1B6IBBgGaXOP7tCF17xGbvvy4+n4yNvyhutMp/01VZ YyMd5OYF+7ATno1woPlYlVHyZpstyYmYV9txvrwQ3Sg5GDiJ3wPNNAgq8vNRapURfVHV FZUpYOu46jokNctwgWQFrN9uUxMv7WKpJAM5UZfUlbtmhbxnBs3lc2GqOXK2DR3DvtAu boNz4Bo7FJdKQEVQKV5Bsh+Uvt8gFYj6AUByAdPWakTncnd4NB8NddVFxdb8Rx1p/0oJ U9TEBZwZwzaJ/ImUgF6RbLZyKbHpIIh4cQNpTY4cASgh6KNY3QX4hoaKwdgeuRYqt15q jn+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SOrdd4XI8slusQze/yS7iFEJWMkT40vmJMm81KqtMYM=; b=MkXjMlBGtDxm9UOZjMl/S6+2MgEXBmoX39p4QkE9yTIUFU3xKoPaGJJmhNwWmufV1I il7Tw6sJDuWng6g21wlgoh7vpel2vWfEStdMtuTVS3RYCmwmyJ7AdMVl2a1Z8unb5RTW FCKFQBTG9LJdRCS3NXYEYLj1lLhsfT3vbJ1cP8/AuHfeA9JxPPx52oU6EvJalcpcLbqL qNT+Ir30RAtNFomQdFGddL0QzAW5cUv9VyzD8Xzfy6h8S3kM400GTTHskAzbn3CUm0zX toxvquJfeqKjk7BQGp4FVoOHlfmrqssaowtP8M6UwqTlUVgoQob1NOeGe/FKkTygjPAt Xilg== X-Gm-Message-State: ALoCoQkcdslClHkuveMrMcoAKQJGIR6XOrod8JlSQqPcDcBtYXYj2IZoxuz2nNmbkIU01F2iLQt0hdLztWuSfHw7cjhmB20C5w== X-Received: by 10.194.58.165 with SMTP id s5mr5242800wjq.70.1452785140559; Thu, 14 Jan 2016 07:25:40 -0800 (PST) Received: from localhost.localdomain (net-2-34-148-78.cust.vodafonedsl.it. [2.34.148.78]) by smtp.gmail.com with ESMTPSA id o7sm6511940wjf.45.2016.01.14.07.25.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jan 2016 07:25:40 -0800 (PST) From: Luca Abeni To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Ingo Molnar , Juri Lelli Subject: [RFC 3/8] sched/deadline: add some tracepoints Date: Thu, 14 Jan 2016 16:24:48 +0100 Message-Id: <1452785094-3086-4-git-send-email-luca.abeni@unitn.it> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1452785094-3086-1-git-send-email-luca.abeni@unitn.it> References: <1452785094-3086-1-git-send-email-luca.abeni@unitn.it> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Juri Lelli These tracepoints can be used to check the active bandwidth tracking and to show SCHED_DEADLINE parameters Signed-off-by: Juri Lelli --- include/trace/events/sched.h | 69 ++++++++++++++++++++++++++++++++++++++++++++ kernel/sched/deadline.c | 6 ++++ 2 files changed, 75 insertions(+) -- 1.9.1 diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index 9b90c57..52644c7 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -408,6 +408,75 @@ DEFINE_EVENT(sched_stat_runtime, sched_stat_runtime, TP_ARGS(tsk, runtime, vruntime)); /* + * Tracepoint for accounting running bandwidth of active SCHED_DEADLINE + * tasks (XXX specific to SCHED_FLAG_GRUB). + */ +DECLARE_EVENT_CLASS(sched_stat_running_bw, + + TP_PROTO(struct task_struct *tsk, u64 tsk_bw, s64 running_bw), + + TP_ARGS(tsk, tsk_bw, running_bw), + + TP_STRUCT__entry( + __array( char, comm, TASK_COMM_LEN ) + __field( pid_t, pid ) + __field( u64, tsk_bw ) + __field( s64, running_bw ) + __field( int, cpu ) + ), + + TP_fast_assign( + memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); + __entry->cpu = task_cpu(tsk); + __entry->pid = tsk->pid; + __entry->tsk_bw = tsk_bw; + __entry->running_bw = running_bw; + ), + + TP_printk("comm=%s pid=%d cpu=%d tsk_bw=%Lu running_bw=%Ld ", + __entry->comm, __entry->pid, __entry->cpu, + (unsigned long long)__entry->tsk_bw, + (unsigned long long)__entry->running_bw) +); + +DEFINE_EVENT(sched_stat_running_bw, sched_stat_running_bw_add, + TP_PROTO(struct task_struct *tsk, u64 tsk_bw, s64 running_bw), + TP_ARGS(tsk, tsk_bw, running_bw)); + +DEFINE_EVENT(sched_stat_running_bw, sched_stat_running_bw_clear, + TP_PROTO(struct task_struct *tsk, u64 tsk_bw, s64 running_bw), + TP_ARGS(tsk, tsk_bw, running_bw)); +/* + * Tracepoint for showing actual parameters of SCHED_DEADLINE + * tasks. + */ +TRACE_EVENT(sched_stat_params_dl, + + TP_PROTO(struct task_struct *tsk, s64 runtime, u64 deadline), + + TP_ARGS(tsk, runtime, deadline), + + TP_STRUCT__entry( + __array( char, comm, TASK_COMM_LEN ) + __field( pid_t, pid ) + __field( s64, runtime ) + __field( u64, deadline ) + ), + + TP_fast_assign( + memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); + __entry->pid = tsk->pid; + __entry->runtime = runtime; + __entry->deadline = deadline; + ), + + TP_printk("comm=%s pid=%d runtime=%Ld [ns] deadline=%Lu", + __entry->comm, __entry->pid, + __entry->runtime, __entry->deadline) +); + + +/* * Tracepoint for showing priority inheritance modifying a tasks * priority. */ diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 8d7ee79..d8e9962 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -18,6 +18,8 @@ #include +#include + struct dl_bandwidth def_dl_bandwidth; static inline struct task_struct *dl_task_of(struct sched_dl_entity *dl_se) @@ -48,6 +50,7 @@ static void add_running_bw(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq) u64 se_bw = dl_se->dl_bw; dl_rq->running_bw += se_bw; + trace_sched_stat_running_bw_add(dl_task_of(dl_se), se_bw, dl_rq->running_bw); } static void clear_running_bw(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq) @@ -55,6 +58,7 @@ static void clear_running_bw(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq) u64 se_bw = dl_se->dl_bw; dl_rq->running_bw -= se_bw; + trace_sched_stat_running_bw_clear(dl_task_of(dl_se), se_bw, dl_rq->running_bw); if (dl_rq->running_bw < 0) { WARN_ON(1); dl_rq->running_bw = 0; @@ -770,6 +774,7 @@ static void update_curr_dl(struct rq *rq) sched_rt_avg_update(rq, delta_exec); dl_se->runtime -= dl_se->dl_yielded ? 0 : delta_exec; + trace_sched_stat_params_dl(curr, dl_se->runtime, dl_se->deadline); if (dl_runtime_exceeded(dl_se)) { dl_se->dl_throttled = 1; __dequeue_task_dl(rq, curr, 0); @@ -987,6 +992,7 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags) } enqueue_dl_entity(&p->dl, pi_se, flags); + trace_sched_stat_params_dl(p, p->dl.runtime, p->dl.deadline); if (!task_current(rq, p) && p->nr_cpus_allowed > 1) enqueue_pushable_dl_task(rq, p);