*
* lock_notify: notify a process of a system event
* lock_send: send a message to a process
- * lock_enqueue: put a process on one of the scheduling queues
- * lock_dequeue: remove a process from the scheduling queues
*
* Changes:
* Aug 19, 2005 rewrote scheduling code (Jorrit N. Herder)
dst->p_delivermsg.m_source = ep;
dst->p_misc_flags |= MF_DELIVERMSG;
-#if 0
- if(iskernelp(dst) || ptproc == dst) {
- printf("instant delivery to %d\n", dst->p_endpoint);
- delivermsg(dst);
- } else {
- printf("queued delivery to %d\n", dst->p_endpoint);
- }
-#endif
-
NOREC_RETURN(queuemess, OK);
}
}
TRACE(VF_SCHEDULING, printf("starting %s / %d\n",
proc_ptr->p_name, proc_ptr->p_endpoint););
+#if DEBUG_TRACE
+ proc_ptr->p_schedules++;
+#endif
NOREC_RETURN(schedch, );
}
return(result);
}
-/*===========================================================================*
- * lock_enqueue *
- *===========================================================================*/
-PUBLIC void lock_enqueue(rp)
-struct proc *rp; /* this process is now runnable */
-{
-/* Safe gateway to enqueue() for tasks. */
- lock;
- enqueue(rp);
- unlock;
-}
-
-/*===========================================================================*
- * lock_dequeue *
- *===========================================================================*/
-PUBLIC void lock_dequeue(rp)
-struct proc *rp; /* this process is no longer runnable */
-{
-/* Safe gateway to dequeue() for tasks. */
- if (k_reenter >= 0) {
- /* We're in an exception or interrupt, so don't lock (and ...
- * don't unlock).
- */
- dequeue(rp);
- } else {
- lock;
- dequeue(rp);
- unlock;
- }
-}
-
/*===========================================================================*
* endpoint_lookup *
*===========================================================================*/
#define PMAGIC 0xC0FFEE1
int p_magic; /* check validity of proc pointers */
#endif
+
+#if DEBUG_TRACE
+ int p_schedules;
+#endif
};
/* Bits for the runtime flags. A process is runnable iff p_rts_flags == 0. */
/* Set flags to this value. */
#define RTS_LOCK_SETFLAGS(rp, f) \
do { \
- if(!(rp)->p_rts_flags && (f)) { lock_dequeue(rp); } \
- (rp)->p_rts_flags = (f); \
+ int u = 0; \
+ if(!intr_disabled()) { u = 1; lock; } \
+ if(!(rp)->p_rts_flags && (f)) { dequeue(rp); } \
+ (rp)->p_rts_flags = (f); \
+ if(u) { unlock; } \
} while(0)
/* Misc flags */
_PROTOTYPE( void sys_call_restart, (struct proc *caller) );
_PROTOTYPE( int lock_notify, (int src, int dst) );
_PROTOTYPE( int lock_send, (int dst, message *m_ptr) );
-_PROTOTYPE( void lock_enqueue, (struct proc *rp) );
-_PROTOTYPE( void lock_dequeue, (struct proc *rp) );
_PROTOTYPE( void enqueue, (struct proc *rp) );
_PROTOTYPE( void dequeue, (struct proc *rp) );
_PROTOTYPE( void balance_queues, (struct timer *tp) );