cleaned up contextswitch
authorRené Sechting <sechting@mailbox.tu-berlin.de>
Wed, 20 Nov 2013 14:31:22 +0000 (15:31 +0100)
committerRené Sechting <sechting@mailbox.tu-berlin.de>
Wed, 20 Nov 2013 14:31:22 +0000 (15:31 +0100)
everything that has to do with the context switch is now inside the
framework. that way a lot of code became unnecessary and is removed.
therefor it is cleaned up :)

framework/os/linux/os.c
kernel/sched.new/core.c

index 2401866..af4e410 100644 (file)
@@ -53,19 +53,19 @@ void os_dispatch(fw_task_t *task)
        prev = rq->curr;
        next = (struct task_struct*)task->real_task;
 
-//     printk("rq: %p",rq);
-
        next->se.exec_start = rq->clock_task;
        clear_tsk_need_resched(prev);
-       clear_tsk_need_resched(next);
        rq->skip_clock_update = 0;
        rq->nr_switches++;
        rq->curr = next;
        rq->prev = prev;
+
        if(prev != next){
                context_switch(rq,prev,next);
+               arch_local_irq_enable();
+       }else{
+               raw_spin_unlock_irq(&rq->lock);
        }
-//     arch_local_irq_enable();
 }
 
 void os_dispatch_mp(fw_task_t *task, int cpu)
index 558fa68..aa179c3 100644 (file)
@@ -1612,7 +1612,7 @@ context_switch(struct rq *rq, struct task_struct *prev,
  */
 static void __sched __schedule(void)
 {
-       struct task_struct *prev, *next;
+       struct task_struct *prev;
        struct rq *rq;
        int cpu;
 
@@ -1620,7 +1620,6 @@ need_resched:
        preempt_disable();//Important, calls __barrier
        cpu = smp_processor_id();
        rq = cpu_rq(cpu);
-//     rcu_note_context_switch(cpu);//May be important for SMP?
        prev = rq->curr;
 
        raw_spin_lock_irq(&rq->lock);
@@ -1656,31 +1655,6 @@ need_resched:
                send_to_topic(3,NULL);
        }
 
-       cpu = smp_processor_id();
-       rq = cpu_rq(cpu);
-       prev = rq->prev;
-       next = rq->curr;
-
-       clear_tsk_need_resched(prev);
-       rq->skip_clock_update = 0;
-
-       if (likely(prev != next)) {
-
-               arch_local_irq_enable();
-//
-//             /*
-//              * The context switch have flipped the stack from under us
-//              * and restored the local variables which were saved when
-//              * this task called schedule() in the past. prev == current
-//              * is still correct, but it can be moved to another cpu/rq.
-//              */
-               cpu = smp_processor_id();
-               rq = cpu_rq(cpu);
-       }else{
-               raw_spin_unlock_irq(&rq->lock);
-       }
-       post_schedule(rq);
-
        sched_preempt_enable_no_resched();
        if (need_resched())
                goto need_resched;