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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A1BA696.9090404@cn.fujitsu.com>
Date:	Tue, 26 May 2009 16:21:42 +0800
From:	Zhaolei <zhaolei@...fujitsu.com>
To:	Ingo Molnar <mingo@...e.hu>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Steven Rostedt <rostedt@...dmis.org>
CC:	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 3/3] tracing/workqueue: make events sort in ascending order

Events in workqueue tracer need to be sorted in ascending order to make user
clear.
But now it is reversed by "tracing/stat: replace linked list by an rbtree
for sorting"(53059c9b67a62a3dc8c80204d3da42b9267ea5a0).
We need to define a custom cmp() callback to make sorting correct.

Before patch:
 # CPU INSERTED EXECUTED   MAX us   AVG us   TASKNAME:PID
 #  |     |        |         |        |      `-WORKFUNC
 #  |     |        |         |        |           |
     0        1        1     1155     1155   `-xprt_autoclose
     0       19       19      864      143   |-xs_udp_connect_worker4
 ...
     0        1        1     4825     4825   |-reg_todo
     0      443      515                     events/0:5

After patch:
 # CPU INSERTED EXECUTED   MAX us   AVG us   TASKNAME:PID
 #  |     |        |         |        |      `-WORKFUNC
 #  |     |        |         |        |           |
     0      443      515                     events/0:5
     0        1        1     4825     4825   |-reg_todo
 ...
     0       19       19      797      134   |-xs_udp_connect_worker4
     0        1        1     8359     8359   `-xprt_autoclose

Signed-off-by: Zhao Lei <zhaolei@...fujitsu.com>
---
 kernel/trace/trace_workqueue.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/kernel/trace/trace_workqueue.c b/kernel/trace/trace_workqueue.c
index 53fe43e..7fa0d23 100644
--- a/kernel/trace/trace_workqueue.c
+++ b/kernel/trace/trace_workqueue.c
@@ -383,6 +383,12 @@ static void *workqueue_stat_next(void *prev, int idx)
 	return ret;
 }
 
+/* To make events sort in ascending order */
+static int workqueue_stat_cmp(void *p1, void *p2)
+{
+	return -1;
+}
+
 static int workqueue_stat_show(struct seq_file *s, void *p)
 {
 	struct workfunc_stats *wfstat = p;
@@ -470,6 +476,7 @@ static struct tracer_stat workqueue_stats __read_mostly = {
 	.name		= "workqueues",
 	.stat_start	= workqueue_stat_start,
 	.stat_next	= workqueue_stat_next,
+	.stat_cmp	= workqueue_stat_cmp,
 	.stat_show	= workqueue_stat_show,
 	.stat_headers	= workqueue_stat_headers,
 	.file_open	= workqueue_stat_file_open,
-- 
1.5.5.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