Fixed a task suspend/resume scheduler issue.

- Scheduler was increasing total priorities only when resuming tasks had 0 ticks.
This caused forked tasks that have parent's share of ticks to finish their jobs,
if these tasks exited quick enough, they would cause the total priorities to deduce
without increasing it in the first place. This is now fixed.

- Also strengthened rq locking, now both queues are locked before touching any.
- Also removed task suspends in irq, this would cause a race condition on ticks and
  runqueues, since neither is protected against irqs.
This commit is contained in:
Bahadir Balban
2008-10-22 13:00:28 +03:00
parent b20fda9341
commit 1ee5cc9c2b
5 changed files with 77 additions and 90 deletions

View File

@@ -75,6 +75,11 @@ static inline void irq_local_disable()
/* This is filled on entry to irq handler, only if a process was interrupted.*/
extern unsigned int preempted_psr;
/*
* FIXME: TASK_IN_KERNEL works for non-current tasks, in_kernel() works for current task?
* in_kernel() is for irq, since normally in process context you know if you are in kernel or not :-)
*/
/* Implementing these as functions cause circular include dependency for tcb.h */
#define TASK_IN_KERNEL(tcb) (((tcb)->context.spsr & ARM_MODE_MASK) == ARM_MODE_SVC)
#define TASK_IN_USER(tcb) (!TASK_IN_KERNEL(tcb))

View File

@@ -148,7 +148,5 @@ extern struct id_pool *thread_id_pool;
extern struct id_pool *space_id_pool;
extern struct id_pool *tgroup_id_pool;
void task_process_pending_flags(void);
#endif /* __TCB_H__ */