From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753163AbcBWO2C (ORCPT ); Tue, 23 Feb 2016 09:28:02 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:35793 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752928AbcBWO2A (ORCPT ); Tue, 23 Feb 2016 09:28:00 -0500 Date: Tue, 23 Feb 2016 15:27:53 +0100 From: Peter Zijlstra To: Steven Rostedt Cc: Daniel Bristot de Oliveira , Ingo Molnar , Thomas Gleixner , Juri Lelli , Arnaldo Carvalho de Melo , LKML , linux-rt-users Subject: Re: [PATCH 3/4] sched/deadline: Tracepoints for deadline scheduler Message-ID: <20160223142753.GR6375@twins.programming.kicks-ass.net> References: <20160222173259.GM6357@twins.programming.kicks-ass.net> <20160222124854.3816fec4@gandalf.local.home> <20160222213017.GN6357@twins.programming.kicks-ass.net> <20160222173043.24873ae8@gandalf.local.home> <20160223104408.GO6357@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160223104408.GO6357@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 23, 2016 at 11:44:08AM +0100, Peter Zijlstra wrote: > include/trace/events/sched.h | 97 +++++++++++++++++++++++++++++++++++++++----- > 1 file changed, 86 insertions(+), 11 deletions(-) > > diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h > index 9b90c57517a9..b902eb71830b 100644 > --- a/include/trace/events/sched.h > +++ b/include/trace/events/sched.h > @@ -103,9 +103,15 @@ DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new, > TP_PROTO(struct task_struct *p), > TP_ARGS(p)); > > +#define TASK_STATE_PREEMPT (TASK_STATE_MAX << 0) > +#define TASK_STATE_THROTTLED (TASK_STATE_MAX << 1) > +#define TASK_STATE_YIELDED (TASK_STATE_MAX << 2) > + > #ifdef CREATE_TRACE_POINTS > static inline long __trace_sched_switch_state(bool preempt, struct task_struct *p) > { > + long state = p->state; > + > #ifdef CONFIG_SCHED_DEBUG > BUG_ON(p != current); > #endif /* CONFIG_SCHED_DEBUG */ > @@ -114,10 +120,49 @@ static inline long __trace_sched_switch_state(bool preempt, struct task_struct * > * Preemption ignores task state, therefore preempted tasks are always > * RUNNING (we will not have dequeued if state != RUNNING). > */ > - return preempt ? TASK_RUNNING | TASK_STATE_MAX : p->state; > + if (preempt) { > + state = TASK_RUNNING | TASK_STATE_MAX; > + } else if (dl_task(p)) { > + if (p->dl.dl_throttled) > + state |= TASK_STATE_THROTTLED; > + else if (p->dl.dl_yielded) > + state |= TASK_STATE_YIELDED; These might want to be inverted, that is, yielded will have throttled set, so yield should take precedence. > + } > + > + return state; > } > #endif /* CREATE_TRACE_POINTS */ > > +#define __trace_sched_switch_fields(name) do { \ > + __entry->name##_policy = name->policy; \ > + switch (name->policy) { \ Sadly we cannot use policy, for that isn't updated on PI. The best we can do is dl_task(), rt_task() else ... > + case SCHED_IDLE: \ This doesn't have nice, so should go with default; > + case SCHED_BATCH: \ > + case SCHED_NORMAL: \ > + __entry->name##_f1 = PRIO_TO_NICE(name->static_prio); \ > + __entry->name##_f2 = 0; \ > + __entry->name##_f3 = 0; \ > + break; \ > + case SCHED_RR: \ > + case SCHED_FIFO: \ > + __entry->name##_f1 = USER_PRIO(name->normal_prio); \ > + __entry->name##_f2 = 0; \ > + __entry->name##_f3 = 0; \ > + break; \ > + case SCHED_DEADLINE: \ > + __entry->name##_f1 = name->dl.runtime; \ > + __entry->name##_f2 = name->dl.deadline; \ > + __entry->name##_f3 = name->dl.dl_period; \ > + break; \ > + default: \ > + __entry->name##_f1 = 0; \ > + __entry->name##_f2 = 0; \ > + __entry->name##_f3 = 0; \ > + break; \ > + } \ > +} while (0)