/[rtmk]/rtmk/sched-ts.c
ViewVC logotype

Diff of /rtmk/sched-ts.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by jrydberg, Thu Jan 3 01:32:43 2002 UTC revision 1.2 by jrydberg, Mon Jan 7 01:16:21 2002 UTC
# Line 58  ts_select (struct sched_policy *sp, stru Line 58  ts_select (struct sched_policy *sp, stru
58    
59    /* If RUN_MAP is zero - there is no available threads in this policy.  */    /* If RUN_MAP is zero - there is no available threads in this policy.  */
60    
61      spin_lock (&sp->interlock);
62    if (! sp->run_map)    if (! sp->run_map)
63      return 0;      {
64          spin_unlock (&sp->interlock);
65          return 0;
66        }
67    
68   retry_scan:   retry_scan:
69    target = 0;    target = 0;
# Line 94  ts_select (struct sched_policy *sp, stru Line 98  ts_select (struct sched_policy *sp, stru
98    ASSERT (whichq >= 0 && whichq <= 15);    ASSERT (whichq >= 0 && whichq <= 15);
99    queue_remove (&sp->run_queues [whichq], target, struct thread *, runq);    queue_remove (&sp->run_queues [whichq], target, struct thread *, runq);
100    empty_p = queue_empty (&sp->run_queues [whichq]);    empty_p = queue_empty (&sp->run_queues [whichq]);
101      target->runq_list = 0;
102    
103    --sp->run_count;    --sp->run_count;
104    sp->run_map &= ~((!! empty_p) << whichq);    sp->run_map &= ~((!! empty_p) << whichq);
105      spin_unlock (&sp->interlock);
106    
107    return target;    return target;
108  }  }
# Line 110  ts_add (struct sched_policy *sp, struct Line 116  ts_add (struct sched_policy *sp, struct
116  {  {
117    int whichq;    int whichq;
118    
119      ASSERT (thread->runq_list == 0);
120    
121    /* Insert thread into scheduling policy's run queue and update RUN_MAP.  */    /* Insert thread into scheduling policy's run queue and update RUN_MAP.  */
122    
123      spin_lock (&sp->interlock);
124    
125    whichq = (15 - thread->sched_priority);    whichq = (15 - thread->sched_priority);
126    queue_enter (&sp->run_queues [whichq], thread, struct thread *, runq);    queue_enter (&sp->run_queues [whichq], thread, struct thread *, runq);
127    thread->sched_credits = thread->sched_priority;    thread->sched_credits = thread->sched_priority;
128      thread->runq_list = &sp->run_queues [whichq];
129      
130    ++sp->run_count;    ++sp->run_count;
131    sp->run_map |= (1 << whichq);    sp->run_map |= (1 << whichq);
132    
133      spin_unlock (&sp->interlock);
134        
135    /* Check if we should preempt the current running thread.  */    /* Check if we should preempt the current running thread.  */
136    
# Line 139  ts_remove (struct sched_policy *sp, stru Line 152  ts_remove (struct sched_policy *sp, stru
152    
153    /* Insert thread into scheduling policy's run queue and update RUN_MAP.  */    /* Insert thread into scheduling policy's run queue and update RUN_MAP.  */
154    
155      spin_lock (&sp->interlock);
156    whichq = thread->sched_priority;    whichq = thread->sched_priority;
157    queue_remove (&sp->run_queues [whichq], thread, struct thread *, runq);    queue_remove (&sp->run_queues [whichq], thread, struct thread *, runq);
158    
159    --sp->run_count;    --sp->run_count;
160    sp->run_map &= ~((!! sp->run_count) << whichq);    sp->run_map &= ~((!! sp->run_count) << whichq);
161      spin_unlock (&sp->interlock);
162  }  }
163    
164  /* Scheduling decisions at periodic clock tick.  Returns true if we should  /* Scheduling decisions at periodic clock tick.  Returns true if we should

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26