Patch "sched/tracing: Report TASK_RTLOCK_WAIT tasks as TASK_UNINTERRUPTIBLE" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    sched/tracing: Report TASK_RTLOCK_WAIT tasks as TASK_UNINTERRUPTIBLE

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     sched-tracing-report-task_rtlock_wait-tasks-as-task_.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit d51f543c8c1d5f17d92b8706783cede699bf4cdf
Author: Valentin Schneider <valentin.schneider@xxxxxxx>
Date:   Thu Jan 20 16:25:20 2022 +0000

    sched/tracing: Report TASK_RTLOCK_WAIT tasks as TASK_UNINTERRUPTIBLE
    
    [ Upstream commit 25795ef6299f07ce3838f3253a9cb34f64efcfae ]
    
    TASK_RTLOCK_WAIT currently isn't part of TASK_REPORT, thus a task blocking
    on an rtlock will appear as having a task state == 0, IOW TASK_RUNNING.
    
    The actual state is saved in p->saved_state, but reading it after reading
    p->__state has a few issues:
    o that could still be TASK_RUNNING in the case of e.g. rt_spin_lock
    o ttwu_state_match() might have changed that to TASK_RUNNING
    
    As pointed out by Eric, adding TASK_RTLOCK_WAIT to TASK_REPORT implies
    exposing a new state to userspace tools which way not know what to do with
    them. The only information that needs to be conveyed here is that a task is
    waiting on an rt_mutex, which matches TASK_UNINTERRUPTIBLE - there's no
    need for a new state.
    
    Reported-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
    Signed-off-by: Valentin Schneider <valentin.schneider@xxxxxxx>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
    Reviewed-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220120162520.570782-3-valentin.schneider@xxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 8fcf76fed984..031588cd2ccb 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1626,6 +1626,14 @@ static inline unsigned int __task_state_index(unsigned int tsk_state,
 	if (tsk_state == TASK_IDLE)
 		state = TASK_REPORT_IDLE;
 
+	/*
+	 * We're lying here, but rather than expose a completely new task state
+	 * to userspace, we can make this appear as if the task has gone through
+	 * a regular rt_mutex_lock() call.
+	 */
+	if (tsk_state == TASK_RTLOCK_WAIT)
+		state = TASK_UNINTERRUPTIBLE;
+
 	return fls(state);
 }
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux