]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tracing: Record task flag NEED_RESCHED_LAZY.
authorThomas Gleixner <tglx@linutronix.de>
Fri, 22 Nov 2024 20:28:49 +0000 (21:28 +0100)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Fri, 22 Nov 2024 22:49:39 +0000 (17:49 -0500)
The scheduler added NEED_RESCHED_LAZY scheduling. Record this state as
part of trace flags and expose it in the need_resched field.

Record and expose NEED_RESCHED_LAZY.

[bigeasy: Commit description, documentation bits.]

Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/20241122202849.7DfYpJR0@linutronix.de
Reviewed-by: Ankur Arora <ankur.a.arora@oracle.com>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Documentation/trace/ftrace.rst
include/linux/trace_events.h
kernel/trace/trace.c
kernel/trace/trace_output.c

index 74d5bd801b1a8e99513cd7a978dcea716c6496a9..272464bb7c60249fe93e84a4b81a65c85fe654ce 100644 (file)
@@ -1033,9 +1033,13 @@ explains which is which.
   irqs-off: 'd' interrupts are disabled. '.' otherwise.
 
   need-resched:
+       - 'B' all, TIF_NEED_RESCHED, PREEMPT_NEED_RESCHED and TIF_RESCHED_LAZY is set,
        - 'N' both TIF_NEED_RESCHED and PREEMPT_NEED_RESCHED is set,
        - 'n' only TIF_NEED_RESCHED is set,
        - 'p' only PREEMPT_NEED_RESCHED is set,
+       - 'L' both PREEMPT_NEED_RESCHED and TIF_RESCHED_LAZY is set,
+       - 'b' both TIF_NEED_RESCHED and TIF_RESCHED_LAZY is set,
+       - 'l' only TIF_RESCHED_LAZY is set
        - '.' otherwise.
 
   hardirq/softirq:
index 016b29a56c875f9e97bea918b0f229d95891a77d..2a5df5b62cfc709a3502ad254328b20a227f86bf 100644 (file)
@@ -184,6 +184,7 @@ unsigned int tracing_gen_ctx_irq_test(unsigned int irqs_status);
 
 enum trace_flag_type {
        TRACE_FLAG_IRQS_OFF             = 0x01,
+       TRACE_FLAG_NEED_RESCHED_LAZY    = 0x02,
        TRACE_FLAG_NEED_RESCHED         = 0x04,
        TRACE_FLAG_HARDIRQ              = 0x08,
        TRACE_FLAG_SOFTIRQ              = 0x10,
index 3ef047ed9705574a11256369a98d6da9e0fe273a..be62f0ea1814d2a9f7440a1c8bcdabc430f08925 100644 (file)
@@ -2552,6 +2552,8 @@ unsigned int tracing_gen_ctx_irq_test(unsigned int irqs_status)
                trace_flags |= TRACE_FLAG_NEED_RESCHED;
        if (test_preempt_need_resched())
                trace_flags |= TRACE_FLAG_PREEMPT_RESCHED;
+       if (IS_ENABLED(CONFIG_ARCH_HAS_PREEMPT_LAZY) && tif_test_bit(TIF_NEED_RESCHED_LAZY))
+               trace_flags |= TRACE_FLAG_NEED_RESCHED_LAZY;
        return (trace_flags << 16) | (min_t(unsigned int, pc & 0xff, 0xf)) |
                (min_t(unsigned int, migration_disable_value(), 0xf)) << 4;
 }
index e08aee34ef63de4cebef5e991d95aff1aa513f62..da748b7cbc4d53e0eb5fef075891f41d23361cb2 100644 (file)
@@ -462,17 +462,29 @@ int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry)
                bh_off ? 'b' :
                '.';
 
-       switch (entry->flags & (TRACE_FLAG_NEED_RESCHED |
+       switch (entry->flags & (TRACE_FLAG_NEED_RESCHED | TRACE_FLAG_NEED_RESCHED_LAZY |
                                TRACE_FLAG_PREEMPT_RESCHED)) {
+       case TRACE_FLAG_NEED_RESCHED | TRACE_FLAG_NEED_RESCHED_LAZY | TRACE_FLAG_PREEMPT_RESCHED:
+               need_resched = 'B';
+               break;
        case TRACE_FLAG_NEED_RESCHED | TRACE_FLAG_PREEMPT_RESCHED:
                need_resched = 'N';
                break;
+       case TRACE_FLAG_NEED_RESCHED_LAZY | TRACE_FLAG_PREEMPT_RESCHED:
+               need_resched = 'L';
+               break;
+       case TRACE_FLAG_NEED_RESCHED | TRACE_FLAG_NEED_RESCHED_LAZY:
+               need_resched = 'b';
+               break;
        case TRACE_FLAG_NEED_RESCHED:
                need_resched = 'n';
                break;
        case TRACE_FLAG_PREEMPT_RESCHED:
                need_resched = 'p';
                break;
+       case TRACE_FLAG_NEED_RESCHED_LAZY:
+               need_resched = 'l';
+               break;
        default:
                need_resched = '.';
                break;