Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1683732

[for-next][PATCH 4/4] tracing: Attempt to record other information even if some fail

Path csiph.com!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!bofh.it!news.nic.it!robomod
From Steven Rostedt <rostedt@goodmis.org>
Newsgroups linux.kernel
Subject [for-next][PATCH 4/4] tracing: Attempt to record other information even if some fail
Date Sun, 09 Jul 2017 13:50:02 +0200
Message-ID <u1iSS-7ch-29@gated-at.bofh.it> (permalink)
References <u1iSR-7ch-7@gated-at.bofh.it>
Dmarc-Filter OpenDMARC Filter v1.3.2 mail.kernel.org 061FE22C94
Authentication-Results mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org
Authentication-Results mail.kernel.org; spf=none smtp.mailfrom=rostedt@goodmis.org
User-Agent quilt/0.63-1
MIME-Version 1.0
Content-Type text/plain; charset=ISO-8859-15
Content-Disposition inline; filename=0004-tracing-Attempt-to-record-other-information-even-if-.patch
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 75
Organization linux.* mail to news gateway
X-Original-Cc Ingo Molnar <mingo@kernel.org>, Andrew Morton <akpm@linux-foundation.org>, kernel-team@android.com, Ingo Molnar <mingo@redhat.com>, Joel Fernandes <joelaf@google.com>
X-Original-Date Sun, 09 Jul 2017 07:44:01 -0400
X-Original-Message-ID <20170709114418.939267695@goodmis.org>
X-Original-References <20170709114357.683111180@goodmis.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1683732

Show key headers only | View raw


From: Joel Fernandes <joelaf@google.com>

In recent patches where we record comm and tgid at the same time, we skip
continuing to record if any fail. Fix that by trying to record as many things
as we can even if some couldn't be recorded. If any information isn't recorded,
then we don't set trace_taskinfo_save as before.

Link: http://lkml.kernel.org/r/20170706230023.17942-3-joelaf@google.com

Cc: kernel-team@android.com
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Joel Fernandes <joelaf@google.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace.c | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index aee11e3a394f..92af8fd1429b 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2037,11 +2037,20 @@ static bool tracing_record_taskinfo_skip(int flags)
  */
 void tracing_record_taskinfo(struct task_struct *task, int flags)
 {
+	bool done;
+
 	if (tracing_record_taskinfo_skip(flags))
 		return;
-	if ((flags & TRACE_RECORD_CMDLINE) && !trace_save_cmdline(task))
-		return;
-	if ((flags & TRACE_RECORD_TGID) && !trace_save_tgid(task))
+
+	/*
+	 * Record as much task information as possible. If some fail, continue
+	 * to try to record the others.
+	 */
+	done = !(flags & TRACE_RECORD_CMDLINE) || trace_save_cmdline(task);
+	done &= !(flags & TRACE_RECORD_TGID) || trace_save_tgid(task);
+
+	/* If recording any information failed, retry again soon. */
+	if (!done)
 		return;
 
 	__this_cpu_write(trace_taskinfo_save, false);
@@ -2058,15 +2067,22 @@ void tracing_record_taskinfo(struct task_struct *task, int flags)
 void tracing_record_taskinfo_sched_switch(struct task_struct *prev,
 					  struct task_struct *next, int flags)
 {
+	bool done;
+
 	if (tracing_record_taskinfo_skip(flags))
 		return;
 
-	if ((flags & TRACE_RECORD_CMDLINE) &&
-	    (!trace_save_cmdline(prev) || !trace_save_cmdline(next)))
-		return;
+	/*
+	 * Record as much task information as possible. If some fail, continue
+	 * to try to record the others.
+	 */
+	done  = !(flags & TRACE_RECORD_CMDLINE) || trace_save_cmdline(prev);
+	done &= !(flags & TRACE_RECORD_CMDLINE) || trace_save_cmdline(next);
+	done &= !(flags & TRACE_RECORD_TGID) || trace_save_tgid(prev);
+	done &= !(flags & TRACE_RECORD_TGID) || trace_save_tgid(next);
 
-	if ((flags & TRACE_RECORD_TGID) &&
-	    (!trace_save_tgid(prev) || !trace_save_tgid(next)))
+	/* If recording any information failed, retry again soon. */
+	if (!done)
 		return;
 
 	__this_cpu_write(trace_taskinfo_save, false);
-- 
2.10.2

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[for-next][PATCH 0/4] tracing: A few more changes for 4.13 Steven Rostedt <rostedt@goodmis.org> - 2017-07-09 13:50 +0200
  [for-next][PATCH 4/4] tracing: Attempt to record other information even if some fail Steven Rostedt <rostedt@goodmis.org> - 2017-07-09 13:50 +0200

csiph-web