Loading include/linux/sched/sysctl.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -42,6 +42,10 @@ walt_proc_update_handler(struct ctl_table *table, int write, #endif /* CONFIG_SCHED_WALT */ #endif /* CONFIG_SCHED_WALT */ #if defined(CONFIG_PREEMPT_TRACER) || defined(CONFIG_IRQSOFF_TRACER) extern unsigned int sysctl_preemptoff_tracing_threshold_ns; #endif enum sched_tunable_scaling { enum sched_tunable_scaling { SCHED_TUNABLESCALING_NONE, SCHED_TUNABLESCALING_NONE, SCHED_TUNABLESCALING_LOG, SCHED_TUNABLESCALING_LOG, Loading include/trace/events/sched.h +33 −0 Original line number Original line Diff line number Diff line Loading @@ -1875,6 +1875,39 @@ TRACE_EVENT(sched_isolate, __entry->requested_cpu, __entry->isolated_cpus, __entry->requested_cpu, __entry->isolated_cpus, __entry->time, __entry->isolate) __entry->time, __entry->isolate) ); ); TRACE_EVENT(sched_preempt_disable, TP_PROTO(u64 delta, bool irqs_disabled, unsigned long caddr0, unsigned long caddr1, unsigned long caddr2, unsigned long caddr3), TP_ARGS(delta, irqs_disabled, caddr0, caddr1, caddr2, caddr3), TP_STRUCT__entry( __field(u64, delta) __field(bool, irqs_disabled) __field(void*, caddr0) __field(void*, caddr1) __field(void*, caddr2) __field(void*, caddr3) ), TP_fast_assign( __entry->delta = delta; __entry->irqs_disabled = irqs_disabled; __entry->caddr0 = (void *)caddr0; __entry->caddr1 = (void *)caddr1; __entry->caddr2 = (void *)caddr2; __entry->caddr3 = (void *)caddr3; ), TP_printk("delta=%llu(ns) irqs_d=%d Callers:(%pf<-%pf<-%pf<-%pf)", __entry->delta, __entry->irqs_disabled, __entry->caddr0, __entry->caddr1, __entry->caddr2, __entry->caddr3) ); #endif /* _TRACE_SCHED_H */ #endif /* _TRACE_SCHED_H */ /* This part must be outside protection */ /* This part must be outside protection */ Loading kernel/sched/core.c +36 −1 Original line number Original line Diff line number Diff line Loading @@ -3322,17 +3322,39 @@ u64 scheduler_tick_max_deferment(void) #if defined(CONFIG_PREEMPT) && (defined(CONFIG_DEBUG_PREEMPT) || \ #if defined(CONFIG_PREEMPT) && (defined(CONFIG_DEBUG_PREEMPT) || \ defined(CONFIG_PREEMPT_TRACER)) defined(CONFIG_PREEMPT_TRACER)) /* * preemptoff stack tracing threshold in ns. * default: 1ms */ unsigned int sysctl_preemptoff_tracing_threshold_ns = 1000000UL; struct preempt_store { u64 ts; unsigned long caddr[4]; bool irqs_disabled; }; static DEFINE_PER_CPU(struct preempt_store, the_ps); /* /* * If the value passed in is equal to the current preempt count * If the value passed in is equal to the current preempt count * then we just disabled preemption. Start timing the latency. * then we just disabled preemption. Start timing the latency. */ */ static inline void preempt_latency_start(int val) static inline void preempt_latency_start(int val) { { struct preempt_store *ps = &per_cpu(the_ps, raw_smp_processor_id()); if (preempt_count() == val) { if (preempt_count() == val) { unsigned long ip = get_lock_parent_ip(); unsigned long ip = get_lock_parent_ip(); #ifdef CONFIG_DEBUG_PREEMPT #ifdef CONFIG_DEBUG_PREEMPT current->preempt_disable_ip = ip; current->preempt_disable_ip = ip; #endif #endif ps->ts = sched_clock(); ps->caddr[0] = CALLER_ADDR0; ps->caddr[1] = CALLER_ADDR1; ps->caddr[2] = CALLER_ADDR2; ps->caddr[3] = CALLER_ADDR3; ps->irqs_disabled = irqs_disabled(); trace_preempt_off(CALLER_ADDR0, ip); trace_preempt_off(CALLER_ADDR0, ip); } } } } Loading Loading @@ -3365,9 +3387,22 @@ NOKPROBE_SYMBOL(preempt_count_add); */ */ static inline void preempt_latency_stop(int val) static inline void preempt_latency_stop(int val) { { if (preempt_count() == val) if (preempt_count() == val) { struct preempt_store *ps = &per_cpu(the_ps, raw_smp_processor_id()); u64 delta = sched_clock() - ps->ts; /* * Trace preempt disable stack if preemption * is disabled for more than the threshold. */ if (delta > sysctl_preemptoff_tracing_threshold_ns) trace_sched_preempt_disable(delta, ps->irqs_disabled, ps->caddr[0], ps->caddr[1], ps->caddr[2], ps->caddr[3]); trace_preempt_on(CALLER_ADDR0, get_lock_parent_ip()); trace_preempt_on(CALLER_ADDR0, get_lock_parent_ip()); } } } void preempt_count_sub(int val) void preempt_count_sub(int val) { { Loading kernel/sysctl.c +9 −0 Original line number Original line Diff line number Diff line Loading @@ -291,6 +291,15 @@ static struct ctl_table kern_table[] = { .mode = 0644, .mode = 0644, .proc_handler = proc_dointvec, .proc_handler = proc_dointvec, }, }, #if defined(CONFIG_PREEMPT_TRACER) || defined(CONFIG_IRQSOFF_TRACER) { .procname = "preemptoff_tracing_threshold_ns", .data = &sysctl_preemptoff_tracing_threshold_ns, .maxlen = sizeof(unsigned int), .mode = 0644, .proc_handler = proc_dointvec, }, #endif #ifdef CONFIG_SCHED_WALT #ifdef CONFIG_SCHED_WALT { { .procname = "sched_cpu_high_irqload", .procname = "sched_cpu_high_irqload", Loading Loading
include/linux/sched/sysctl.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -42,6 +42,10 @@ walt_proc_update_handler(struct ctl_table *table, int write, #endif /* CONFIG_SCHED_WALT */ #endif /* CONFIG_SCHED_WALT */ #if defined(CONFIG_PREEMPT_TRACER) || defined(CONFIG_IRQSOFF_TRACER) extern unsigned int sysctl_preemptoff_tracing_threshold_ns; #endif enum sched_tunable_scaling { enum sched_tunable_scaling { SCHED_TUNABLESCALING_NONE, SCHED_TUNABLESCALING_NONE, SCHED_TUNABLESCALING_LOG, SCHED_TUNABLESCALING_LOG, Loading
include/trace/events/sched.h +33 −0 Original line number Original line Diff line number Diff line Loading @@ -1875,6 +1875,39 @@ TRACE_EVENT(sched_isolate, __entry->requested_cpu, __entry->isolated_cpus, __entry->requested_cpu, __entry->isolated_cpus, __entry->time, __entry->isolate) __entry->time, __entry->isolate) ); ); TRACE_EVENT(sched_preempt_disable, TP_PROTO(u64 delta, bool irqs_disabled, unsigned long caddr0, unsigned long caddr1, unsigned long caddr2, unsigned long caddr3), TP_ARGS(delta, irqs_disabled, caddr0, caddr1, caddr2, caddr3), TP_STRUCT__entry( __field(u64, delta) __field(bool, irqs_disabled) __field(void*, caddr0) __field(void*, caddr1) __field(void*, caddr2) __field(void*, caddr3) ), TP_fast_assign( __entry->delta = delta; __entry->irqs_disabled = irqs_disabled; __entry->caddr0 = (void *)caddr0; __entry->caddr1 = (void *)caddr1; __entry->caddr2 = (void *)caddr2; __entry->caddr3 = (void *)caddr3; ), TP_printk("delta=%llu(ns) irqs_d=%d Callers:(%pf<-%pf<-%pf<-%pf)", __entry->delta, __entry->irqs_disabled, __entry->caddr0, __entry->caddr1, __entry->caddr2, __entry->caddr3) ); #endif /* _TRACE_SCHED_H */ #endif /* _TRACE_SCHED_H */ /* This part must be outside protection */ /* This part must be outside protection */ Loading
kernel/sched/core.c +36 −1 Original line number Original line Diff line number Diff line Loading @@ -3322,17 +3322,39 @@ u64 scheduler_tick_max_deferment(void) #if defined(CONFIG_PREEMPT) && (defined(CONFIG_DEBUG_PREEMPT) || \ #if defined(CONFIG_PREEMPT) && (defined(CONFIG_DEBUG_PREEMPT) || \ defined(CONFIG_PREEMPT_TRACER)) defined(CONFIG_PREEMPT_TRACER)) /* * preemptoff stack tracing threshold in ns. * default: 1ms */ unsigned int sysctl_preemptoff_tracing_threshold_ns = 1000000UL; struct preempt_store { u64 ts; unsigned long caddr[4]; bool irqs_disabled; }; static DEFINE_PER_CPU(struct preempt_store, the_ps); /* /* * If the value passed in is equal to the current preempt count * If the value passed in is equal to the current preempt count * then we just disabled preemption. Start timing the latency. * then we just disabled preemption. Start timing the latency. */ */ static inline void preempt_latency_start(int val) static inline void preempt_latency_start(int val) { { struct preempt_store *ps = &per_cpu(the_ps, raw_smp_processor_id()); if (preempt_count() == val) { if (preempt_count() == val) { unsigned long ip = get_lock_parent_ip(); unsigned long ip = get_lock_parent_ip(); #ifdef CONFIG_DEBUG_PREEMPT #ifdef CONFIG_DEBUG_PREEMPT current->preempt_disable_ip = ip; current->preempt_disable_ip = ip; #endif #endif ps->ts = sched_clock(); ps->caddr[0] = CALLER_ADDR0; ps->caddr[1] = CALLER_ADDR1; ps->caddr[2] = CALLER_ADDR2; ps->caddr[3] = CALLER_ADDR3; ps->irqs_disabled = irqs_disabled(); trace_preempt_off(CALLER_ADDR0, ip); trace_preempt_off(CALLER_ADDR0, ip); } } } } Loading Loading @@ -3365,9 +3387,22 @@ NOKPROBE_SYMBOL(preempt_count_add); */ */ static inline void preempt_latency_stop(int val) static inline void preempt_latency_stop(int val) { { if (preempt_count() == val) if (preempt_count() == val) { struct preempt_store *ps = &per_cpu(the_ps, raw_smp_processor_id()); u64 delta = sched_clock() - ps->ts; /* * Trace preempt disable stack if preemption * is disabled for more than the threshold. */ if (delta > sysctl_preemptoff_tracing_threshold_ns) trace_sched_preempt_disable(delta, ps->irqs_disabled, ps->caddr[0], ps->caddr[1], ps->caddr[2], ps->caddr[3]); trace_preempt_on(CALLER_ADDR0, get_lock_parent_ip()); trace_preempt_on(CALLER_ADDR0, get_lock_parent_ip()); } } } void preempt_count_sub(int val) void preempt_count_sub(int val) { { Loading
kernel/sysctl.c +9 −0 Original line number Original line Diff line number Diff line Loading @@ -291,6 +291,15 @@ static struct ctl_table kern_table[] = { .mode = 0644, .mode = 0644, .proc_handler = proc_dointvec, .proc_handler = proc_dointvec, }, }, #if defined(CONFIG_PREEMPT_TRACER) || defined(CONFIG_IRQSOFF_TRACER) { .procname = "preemptoff_tracing_threshold_ns", .data = &sysctl_preemptoff_tracing_threshold_ns, .maxlen = sizeof(unsigned int), .mode = 0644, .proc_handler = proc_dointvec, }, #endif #ifdef CONFIG_SCHED_WALT #ifdef CONFIG_SCHED_WALT { { .procname = "sched_cpu_high_irqload", .procname = "sched_cpu_high_irqload", Loading