]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tracing: Treat recording comm for idle task as a success
authorJoel Fernandes <joelaf@google.com>
Thu, 6 Jul 2017 23:00:21 +0000 (16:00 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 May 2021 08:38:20 +0000 (10:38 +0200)
commit eaf260ac04d9b4cf9f458d5c97555bfff2da526e upstream.

Currently we stop recording comm for non-idle tasks when switching from/to idle
task since we treat that as a record failure. Fix that by treat recording of
comm for idle task as a success.

Link: http://lkml.kernel.org/r/20170706230023.17942-1-joelaf@google.com
Cc: kernel-team@android.com
Cc: Ingo Molnar <mingo@redhat.com>
Reported-by: Michael Sartain <mikesart@gmail.com>
Signed-off-by: Joel Fernandes <joelaf@google.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/trace/trace.c

index 37664eb48fb77ca2fed87ceccb2cdf5cd0c41fb7..24ea07cad8ca8fca30baa93ee467f4ac481e43b9 100644 (file)
@@ -1564,7 +1564,11 @@ static int trace_save_cmdline(struct task_struct *tsk)
 {
        unsigned pid, idx;
 
-       if (!tsk->pid || unlikely(tsk->pid > PID_MAX_DEFAULT))
+       /* treat recording of idle task as a success */
+       if (!tsk->pid)
+               return 1;
+
+       if (unlikely(tsk->pid > PID_MAX_DEFAULT))
                return 0;
 
        /*