The wrapper functions __trace_set_current_state() and __trace_set_need_resched() allow the tracepoints to be called from code outside sched/core.c, those calls are already guarded by a tracepoint_enabled(<tp>) so there is no need to repeat this check once again inside the call using trace_<tp>(). Use the new trace_call__<tp>() API to directly call the tracepoint without check. Those helper functions must be called after the appropriate check.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -537,10 +537,14 @@ sched_core_dequeue(struct rq *rq, struct task_struct *p, int flags) { } · 536 unmodified lines | |||
| 537 | /* need a wrapper since we may need to trace from modules */ | 537 | /* need a wrapper since we may need to trace from modules */ |
| 538 | EXPORT_TRACEPOINT_SYMBOL(sched_set_state_tp); | 538 | EXPORT_TRACEPOINT_SYMBOL(sched_set_state_tp); |
| 539 | 539 | ||
| 540 | /* Call via the helper macro trace_set_current_state. */ | 540 | /* |
| 541 | * Call via the helper macro trace_set_current_state. | ||
| 542 | * Calls to this function MUST be guarded by a | ||
| 543 | * tracepoint_enabled(sched_set_state_tp) | ||
| 544 | */ | ||
| 541 | void __trace_set_current_state(int state_value) | 545 | void __trace_set_current_state(int state_value) |
| 542 | { | 546 | { |
| 543 | trace_sched_set_state_tp(current, state_value); | 547 | trace_call__sched_set_state_tp(current, state_value); |
| 544 | } | 548 | } |
| 545 | EXPORT_SYMBOL(__trace_set_current_state); | 549 | EXPORT_SYMBOL(__trace_set_current_state); |
| 546 | 550 | ||
| @@ -1203,9 +1207,13 @@ static void __resched_curr(struct rq *rq, int tif) · 656 unmodified lines | |||
| 1203 | } | 1207 | } |
| 1204 | } | 1208 | } |
| 1205 | 1209 | ||
| 1210 | /* | ||
| 1211 | * Calls to this function MUST be guarded by a | ||
| 1212 | * tracepoint_enabled(sched_set_need_resched_tp) | ||
| 1213 | */ | ||
| 1206 | void __trace_set_need_resched(struct task_struct *curr, int tif) | 1214 | void __trace_set_need_resched(struct task_struct *curr, int tif) |
| 1207 | { | 1215 | { |
| 1208 | trace_sched_set_need_resched_tp(curr, smp_processor_id(), tif); | 1216 | trace_call__sched_set_need_resched_tp(curr, smp_processor_id(), tif); |
| 1209 | } | 1217 | } |
| 1210 | EXPORT_SYMBOL_GPL(__trace_set_need_resched); | 1218 | EXPORT_SYMBOL_GPL(__trace_set_need_resched); |
| 1211 | 1219 | ||