lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 28 May 2010 16:26:02 +0200
From:	Frederic Weisbecker <fweisbec@...il.com>
To:	LKML <linux-kernel@...r.kernel.org>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Ingo Molnar <mingo@...e.hu>,
	Steven Rostedt <rostedt@...dmis.org>
Subject: [PATCH] tracing: Add task activate/deactivate tracepoints

We have various tracepoints that tell us when a task is going to
be enqueued in a runqueue: fork, wakeup, migrate.

But they don't always provide us the level of information necessary
to know what is actually in which runqueue, precisely because the
migrate event is only fired if the task is queued on another
cpu than its previous one. So we don't always know where a waking up
task goes.

And moreover we don't have events that tells a task goes to sleep,
and even that wouldn't cover every cases when a task is dequeued.

So bring these two new tracepoints to get informations about the
load of each runqueues.

Signed-off-by: Frederic Weisbecker <fweisbec@...il.com>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Steven Rostedt <rostedt@...dmis.org>
---
 include/trace/events/sched.h |   36 ++++++++++++++++++++++++++++++++++++
 kernel/sched.c               |    2 ++
 2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 4f733ec..f7f94af 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -185,6 +185,42 @@ TRACE_EVENT(sched_migrate_task,
 		  __entry->orig_cpu, __entry->dest_cpu)
 );
 
+DECLARE_EVENT_CLASS(sched_activation_template,
+
+	TP_PROTO(struct task_struct *p, int cpu),
+
+	TP_ARGS(p, cpu),
+
+	TP_STRUCT__entry(
+		__field(	pid_t,	pid	)
+		__field(	int,	cpu	)
+	),
+
+	TP_fast_assign(
+		__entry->pid		= p->pid;
+		__entry->cpu		= cpu;
+	),
+
+	TP_printk("pid=%d cpu=%d", __entry->pid, __entry->cpu)
+);
+
+
+/*
+ * Tracepoint for activating a task, pulling it in a runqueue
+ */
+DEFINE_EVENT(sched_activation_template, sched_activate_task,
+	     TP_PROTO(struct task_struct *p, int cpu),
+	     TP_ARGS(p, cpu));
+
+
+/*
+ * Tracepoint for deactivating a task, pushing it out a runqueue
+ */
+DEFINE_EVENT(sched_activation_template, sched_deactivate_task,
+	     TP_PROTO(struct task_struct *p, int cpu),
+	     TP_ARGS(p, cpu));
+
+
 DECLARE_EVENT_CLASS(sched_process_template,
 
 	TP_PROTO(struct task_struct *p),
diff --git a/kernel/sched.c b/kernel/sched.c
index 1d93cd0..8c0b90d 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1904,6 +1904,7 @@ static void activate_task(struct rq *rq, struct task_struct *p, int flags)
 	if (task_contributes_to_load(p))
 		rq->nr_uninterruptible--;
 
+	trace_sched_activate_task(p, cpu_of(rq));
 	enqueue_task(rq, p, flags);
 	inc_nr_running(rq);
 }
@@ -1916,6 +1917,7 @@ static void deactivate_task(struct rq *rq, struct task_struct *p, int flags)
 	if (task_contributes_to_load(p))
 		rq->nr_uninterruptible++;
 
+	trace_sched_deactivate_task(p, cpu_of(rq));
 	dequeue_task(rq, p, flags);
 	dec_nr_running(rq);
 }
-- 
1.6.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ