Skip to contentSkip to conversation

preemptoff tracer: trace the preempt enable at preempt_schedule

PATCH New Todd Poynor 1 participant 1 message Nov 13, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 preemptoff tracer: trace the preempt enable at preempt_schedule

preempt_schedule() uses the _notrace versions of the preemption disable/enable routines for setting the PREEMPT_ACTIVE flag to avoid a race condition per commit d1f74e2. This causes the preemptoff trace to not be properly terminated when the preempted thread is rescheduled. Since the original fix only converted the preempt re-enable to use the _notrace version for symmetry, call the tracing version instead. The corresponding preemptoff start will be traced by the preempt_disable() in schedule(), although this may be relying on a fragile state of affairs, and it may be best to also add a direct call to trace a preempt disable after preemption is safely disabled and the race avoided.

---
 kernel/sched.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/sched.c +1 -1
index aa14a56..de83e30 100644
@@ -4041,7 +4041,7 @@ asmlinkage void __sched notrace preempt_schedule(void)
 	do {
 		add_preempt_count_notrace(PREEMPT_ACTIVE);
 		schedule();
-		sub_preempt_count_notrace(PREEMPT_ACTIVE);
+		sub_preempt_count(PREEMPT_ACTIVE);
 
 		/*
 		 * Check again in case we missed a preemption opportunity
Signature · 1 line
1.7.3.1