aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2011-07-31 06:30:01 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2011-07-31 06:30:01 -0400
commitdf774b19b13353722766408d1972947301413082 (patch)
tree1f8b4b41ec506d8e5fd81650d2aa2bc015d53a69
parent17423950c90eeb4da6f818bb4379385f0a14699d (diff)
WIP snapshot
-rw-r--r--kernel/sched.c10
-rw-r--r--litmus/sched_cedf.c32
2 files changed, 31 insertions, 11 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index b1fd83dbfb47..1f5327f8c012 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4660,9 +4660,6 @@ static int __sched_setscheduler(struct task_struct *p, int policy,
4660 struct rq *rq; 4660 struct rq *rq;
4661 int reset_on_fork; 4661 int reset_on_fork;
4662 4662
4663 if (litmus->pre_setsched)
4664 litmus->pre_setsched(p, policy);
4665
4666 /* may grab non-irq protected spin_locks */ 4663 /* may grab non-irq protected spin_locks */
4667 BUG_ON(in_interrupt()); 4664 BUG_ON(in_interrupt());
4668recheck: 4665recheck:
@@ -4853,6 +4850,13 @@ do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
4853 if (copy_from_user(&lparam, param, sizeof(struct sched_param))) 4850 if (copy_from_user(&lparam, param, sizeof(struct sched_param)))
4854 return -EFAULT; 4851 return -EFAULT;
4855 4852
4853#ifdef CONFIG_LITMUS_LOCKING
4854 /* Hack to allow plugin to call into schedule
4855 * prio to a setscheduler() call. */
4856 if (is_realtime(current))
4857 litmus->pre_setsched(current, policy);
4858#endif
4859
4856 rcu_read_lock(); 4860 rcu_read_lock();
4857 retval = -ESRCH; 4861 retval = -ESRCH;
4858 p = find_process_by_pid(pid); 4862 p = find_process_by_pid(pid);
diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c
index f9df2b098493..58c748774a95 100644
--- a/litmus/sched_cedf.c
+++ b/litmus/sched_cedf.c
@@ -995,14 +995,30 @@ static void cedf_task_block(struct task_struct *t)
995#ifdef CONFIG_LITMUS_LOCKING 995#ifdef CONFIG_LITMUS_LOCKING
996static void cedf_pre_setsched(struct task_struct *t, int policy) 996static void cedf_pre_setsched(struct task_struct *t, int policy)
997{ 997{
998 /* we can only handle current atm */ 998
999 if (is_realtime(t) && t == current) { 999 unsigned long flags;
1000 TRACE_CUR("cedf_pre_setsched\n"); 1000 cedf_domain_t *cluster = task_cpu_cluster(t);
1001 1001
1002 /* Pretend to issue a request to make sure 1002 int delay_donor_exit = 0;
1003 * we are no longer a priority donor. */ 1003
1004 priodon_become_eligible(); 1004 while (1) {
1005 priodon_complete_request(); 1005 raw_spin_lock_irqsave(&cluster->cluster_lock, flags);
1006
1007 TRACE_CUR("cedf_pre_setsched wait:%u pend:%d donor:%u req:%u\n",
1008 tsk_rt(t)->waiting_eligible,
1009 tsk_rt(t)->pending_on, tsk_rt(t)->is_donor,
1010 tsk_rt(t)->request_incomplete);
1011
1012 delay_donor_exit = tsk_rt(current)->is_donor;
1013
1014 raw_spin_unlock_irqrestore(&cluster->cluster_lock, flags);
1015
1016 if (!delay_donor_exit)
1017 break;
1018
1019 TRACE_CUR("donor exit delay\n");
1020 set_current_state(TASK_INTERRUPTIBLE);
1021 schedule_timeout(HZ);
1006 } 1022 }
1007} 1023}
1008#endif 1024#endif