linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Cc: Yordan Karadzhov <ykaradzhov@vmware.com>
Subject: [PATCH 1/4] kernel-shark: Remove testing of "success" field of wakeup events
Date: Sun, 10 Feb 2019 20:18:08 -0500	[thread overview]
Message-ID: <20190211012153.848572065@goodmis.org> (raw)
In-Reply-To: 20190211011807.714634783@goodmis.org

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Since 2011 (or Linux version 3.0) the sched wakeup event "success" field has
been hardcoded to true (or 1). There's no reason to waste cycles checking it
in any newer kernel, which is most of them. Just ignore it. Even when
running on older kernels which may have a success=0 value, the algorithm
should still work.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel-shark/src/plugins/sched_events.c | 25 +++----------------------
 kernel-shark/src/plugins/sched_events.h |  8 --------
 2 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/kernel-shark/src/plugins/sched_events.c b/kernel-shark/src/plugins/sched_events.c
index c0328e804911..5b1af7722624 100644
--- a/kernel-shark/src/plugins/sched_events.c
+++ b/kernel-shark/src/plugins/sched_events.c
@@ -68,9 +68,6 @@ static bool plugin_sched_init_context(struct kshark_context *kshark_ctx)
 	plugin_ctx->sched_wakeup_pid_field =
 		tep_find_any_field(event, "pid");
 
-	plugin_ctx->sched_wakeup_success_field =
-		tep_find_field(event, "success");
-
 	event = tep_find_event_by_name(plugin_ctx->pevent,
 				       "sched", "sched_wakeup_new");
 	if (!event)
@@ -80,9 +77,6 @@ static bool plugin_sched_init_context(struct kshark_context *kshark_ctx)
 	plugin_ctx->sched_wakeup_new_pid_field =
 		tep_find_any_field(event, "pid");
 
-	plugin_ctx->sched_wakeup_new_success_field =
-		tep_find_field(event, "success");
-
 	plugin_ctx->second_pass_hash = tracecmd_filter_id_hash_alloc();
 
 	return true;
@@ -175,8 +169,7 @@ bool plugin_wakeup_match_rec_pid(struct kshark_context *kshark_ctx,
 {
 	struct plugin_sched_context *plugin_ctx;
 	struct tep_record *record = NULL;
-	unsigned long long val;
-	int ret, wakeup_pid = -1;
+	int wakeup_pid = -1;
 
 	plugin_ctx = plugin_sched_context_handler;
 	if (!plugin_ctx)
@@ -185,25 +178,13 @@ bool plugin_wakeup_match_rec_pid(struct kshark_context *kshark_ctx,
 	if (plugin_ctx->sched_wakeup_event &&
 	    e->event_id == plugin_ctx->sched_wakeup_event->id) {
 		record = tracecmd_read_at(kshark_ctx->handle, e->offset, NULL);
-
-		/* We only want those that actually woke up the task. */
-		ret = tep_read_number_field(plugin_ctx->sched_wakeup_success_field,
-					    record->data, &val);
-
-		if (ret == 0 && val)
-			wakeup_pid = plugin_get_rec_wakeup_pid(record);
+		wakeup_pid = plugin_get_rec_wakeup_pid(record);
 	}
 
 	if (plugin_ctx->sched_wakeup_new_event &&
 	    e->event_id == plugin_ctx->sched_wakeup_new_event->id) {
 		record = tracecmd_read_at(kshark_ctx->handle, e->offset, NULL);
-
-		/* We only want those that actually woke up the task. */
-		ret = tep_read_number_field(plugin_ctx->sched_wakeup_new_success_field,
-					    record->data, &val);
-
-		if (ret == 0 && val)
-			wakeup_pid = plugin_get_rec_wakeup_new_pid(record);
+		wakeup_pid = plugin_get_rec_wakeup_new_pid(record);
 	}
 
 	free_record(record);
diff --git a/kernel-shark/src/plugins/sched_events.h b/kernel-shark/src/plugins/sched_events.h
index fb1849ee8ffb..0beb63fe2b48 100644
--- a/kernel-shark/src/plugins/sched_events.h
+++ b/kernel-shark/src/plugins/sched_events.h
@@ -45,20 +45,12 @@ struct plugin_sched_context {
 	/** Pointer to the sched_wakeup_pid_field format descriptor. */
 	struct tep_format_field	*sched_wakeup_pid_field;
 
-	/** Pointer to the sched_wakeup_success_field format descriptor. */
-	struct tep_format_field	*sched_wakeup_success_field;
-
 	/** Pointer to the sched_wakeup_new_event object. */
 	struct tep_event	*sched_wakeup_new_event;
 
 	/** Pointer to the sched_wakeup_new_pid_field format descriptor. */
 	struct tep_format_field	*sched_wakeup_new_pid_field;
 
-	/**
-	 * Pointer to the sched_wakeup_new_success_field format descriptor.
-	 */
-	struct tep_format_field	*sched_wakeup_new_success_field;
-
 	/** List of Data collections used by this plugin. */
 	struct kshark_entry_collection	*collections;
 
-- 
2.20.1



  reply	other threads:[~2019-02-11  1:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-11  1:18 [PATCH 0/4] kernel-shark: Add sched_waking event for sched plugin processing Steven Rostedt
2019-02-11  1:18 ` Steven Rostedt [this message]
2019-02-11  1:18 ` [PATCH 2/4] kernel-shark: Consolidate duplicate code of the sched_wakeup events Steven Rostedt
2019-02-11  8:53   ` Yordan Karadzhov
2019-02-11 14:44     ` Steven Rostedt
2019-02-12 17:09       ` Yordan Karadzhov
2019-02-11  1:18 ` [PATCH 3/4] kernel-shark: Remove plugin_get_rec_wakeup_pid() Steven Rostedt
2019-02-11  1:18 ` [PATCH 4/4] kernel-shark: Add sched_waking event processing to sched_waking Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190211012153.848572065@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=ykaradzhov@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).