aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2011-07-26 21:25:52 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2011-07-26 21:25:52 -0400
commit5d39a47acefbba8b5caebc6b7b8ef94983735aac (patch)
tree3e686fb2138355425727e9fdc447739c237ebb36
parenta8defdf2a0a970dbf6a3facee6e5fcf468649195 (diff)
GSN-EDF: avoid double lock acquisition in FMLP
Extra lock acquisition causes unnecessary overhead.
-rw-r--r--litmus/sched_gsn_edf.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/litmus/sched_gsn_edf.c b/litmus/sched_gsn_edf.c
index 9e3eb22eed74..26014437cc3e 100644
--- a/litmus/sched_gsn_edf.c
+++ b/litmus/sched_gsn_edf.c
@@ -697,14 +697,6 @@ static void __clear_priority_inheritance(struct task_struct* t)
697 gsnedf_job_arrival(t); 697 gsnedf_job_arrival(t);
698} 698}
699 699
700/* called with IRQs off */
701static void clear_priority_inheritance(struct task_struct* t)
702{
703 raw_spin_lock(&gsnedf_lock);
704 __clear_priority_inheritance(t);
705 raw_spin_unlock(&gsnedf_lock);
706}
707
708/* set and clear at the same time to avoid having to 700/* set and clear at the same time to avoid having to
709 * acquire the runqueue lock twice */ 701 * acquire the runqueue lock twice */
710static void update_priority_inheritance( 702static void update_priority_inheritance(
@@ -827,7 +819,7 @@ int gsnedf_fmlp_lock(struct litmus_lock* l)
827 819
828int gsnedf_fmlp_unlock(struct litmus_lock* l) 820int gsnedf_fmlp_unlock(struct litmus_lock* l)
829{ 821{
830 struct task_struct *t = current, *next; 822 struct task_struct *t = current, *next, *blocked = NULL;
831 struct fmlp_semaphore *sem = fmlp_from_lock(l); 823 struct fmlp_semaphore *sem = fmlp_from_lock(l);
832 unsigned long flags; 824 unsigned long flags;
833 int err = 0; 825 int err = 0;
@@ -862,7 +854,7 @@ int gsnedf_fmlp_unlock(struct litmus_lock* l)
862 /* Well, if next is not the highest-priority waiter, 854 /* Well, if next is not the highest-priority waiter,
863 * then it ought to inherit the highest-priority 855 * then it ought to inherit the highest-priority
864 * waiter's priority. */ 856 * waiter's priority. */
865 set_priority_inheritance(next, sem->hp_waiter); 857 blocked = sem->hp_waiter;
866 } 858 }
867 859
868 /* wake up next */ 860 /* wake up next */
@@ -872,8 +864,8 @@ int gsnedf_fmlp_unlock(struct litmus_lock* l)
872 sem->owner = NULL; 864 sem->owner = NULL;
873 865
874 /* we lose the benefit of priority inheritance (if any) */ 866 /* we lose the benefit of priority inheritance (if any) */
875 if (tsk_rt(t)->inh_task) 867 if (tsk_rt(t)->inh_task || blocked)
876 clear_priority_inheritance(t); 868 update_priority_inheritance(t, next, blocked);
877 869
878out: 870out:
879 spin_unlock_irqrestore(&sem->wait.lock, flags); 871 spin_unlock_irqrestore(&sem->wait.lock, flags);