From bb4922c968aa1a30fddd6ad9d0f750706c7b3b29 Mon Sep 17 00:00:00 2001 From: Glenn Elliott Date: Sun, 15 Apr 2012 18:09:59 -0400 Subject: PAI::change_prio(): check work before locking --- litmus/sched_gsn_edf.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/litmus/sched_gsn_edf.c b/litmus/sched_gsn_edf.c index 37f7821dca50..37294111bb0c 100644 --- a/litmus/sched_gsn_edf.c +++ b/litmus/sched_gsn_edf.c @@ -723,15 +723,16 @@ static void gsnedf_change_prio_pai_tasklet(struct task_struct *old_prio, struct tasklet_struct* step; unsigned long flags; - raw_spin_lock_irqsave(&gsnedf_lock, flags); - - for(step = gsnedf_pending_tasklets.head; step != NULL; step = step->next) { - if(step->owner == old_prio) { - TRACE("%s: Found tasklet to flush: %d\n", __FUNCTION__, step->owner->pid); - step->owner = new_prio; + if(gsnedf_pending_tasklets.head != NULL) { + raw_spin_lock_irqsave(&gsnedf_lock, flags); + for(step = gsnedf_pending_tasklets.head; step != NULL; step = step->next) { + if(step->owner == old_prio) { + TRACE("%s: Found tasklet to change: %d\n", __FUNCTION__, step->owner->pid); + step->owner = new_prio; + } } + raw_spin_unlock_irqrestore(&gsnedf_lock, flags); } - raw_spin_unlock_irqrestore(&gsnedf_lock, flags); } #endif // end PAI -- cgit v1.2.2