minor cleanup
This commit is contained in:
parent
0702c826a2
commit
e2a7535c55
|
|
@ -28,7 +28,7 @@
|
||||||
#define DEBUG_VMASSERT 0
|
#define DEBUG_VMASSERT 0
|
||||||
#define DEBUG_SCHED_CHECK 0
|
#define DEBUG_SCHED_CHECK 0
|
||||||
#define DEBUG_STACK_CHECK 0
|
#define DEBUG_STACK_CHECK 0
|
||||||
#define DEBUG_TRACE 0
|
#define DEBUG_TRACE 1
|
||||||
|
|
||||||
#if DEBUG_TRACE
|
#if DEBUG_TRACE
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,6 @@
|
||||||
*
|
*
|
||||||
* lock_notify: notify a process of a system event
|
* lock_notify: notify a process of a system event
|
||||||
* lock_send: send a message to a process
|
* 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:
|
* Changes:
|
||||||
* Aug 19, 2005 rewrote scheduling code (Jorrit N. Herder)
|
* Aug 19, 2005 rewrote scheduling code (Jorrit N. Herder)
|
||||||
|
|
@ -107,15 +105,6 @@ PRIVATE int QueueMess(endpoint_t ep, vir_bytes msg_lin, struct proc *dst)
|
||||||
dst->p_delivermsg.m_source = ep;
|
dst->p_delivermsg.m_source = ep;
|
||||||
dst->p_misc_flags |= MF_DELIVERMSG;
|
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);
|
NOREC_RETURN(queuemess, OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -153,6 +142,9 @@ PUBLIC void schedcheck(void)
|
||||||
}
|
}
|
||||||
TRACE(VF_SCHEDULING, printf("starting %s / %d\n",
|
TRACE(VF_SCHEDULING, printf("starting %s / %d\n",
|
||||||
proc_ptr->p_name, proc_ptr->p_endpoint););
|
proc_ptr->p_name, proc_ptr->p_endpoint););
|
||||||
|
#if DEBUG_TRACE
|
||||||
|
proc_ptr->p_schedules++;
|
||||||
|
#endif
|
||||||
NOREC_RETURN(schedch, );
|
NOREC_RETURN(schedch, );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1269,37 +1261,6 @@ message *m_ptr; /* pointer to message buffer */
|
||||||
return(result);
|
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 *
|
* endpoint_lookup *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,10 @@ struct proc {
|
||||||
#define PMAGIC 0xC0FFEE1
|
#define PMAGIC 0xC0FFEE1
|
||||||
int p_magic; /* check validity of proc pointers */
|
int p_magic; /* check validity of proc pointers */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if DEBUG_TRACE
|
||||||
|
int p_schedules;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Bits for the runtime flags. A process is runnable iff p_rts_flags == 0. */
|
/* Bits for the runtime flags. A process is runnable iff p_rts_flags == 0. */
|
||||||
|
|
@ -161,8 +165,11 @@ struct proc {
|
||||||
/* Set flags to this value. */
|
/* Set flags to this value. */
|
||||||
#define RTS_LOCK_SETFLAGS(rp, f) \
|
#define RTS_LOCK_SETFLAGS(rp, f) \
|
||||||
do { \
|
do { \
|
||||||
if(!(rp)->p_rts_flags && (f)) { lock_dequeue(rp); } \
|
int u = 0; \
|
||||||
|
if(!intr_disabled()) { u = 1; lock; } \
|
||||||
|
if(!(rp)->p_rts_flags && (f)) { dequeue(rp); } \
|
||||||
(rp)->p_rts_flags = (f); \
|
(rp)->p_rts_flags = (f); \
|
||||||
|
if(u) { unlock; } \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
/* Misc flags */
|
/* Misc flags */
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,6 @@ _PROTOTYPE( int sys_call, (int call_nr, int src_dst,
|
||||||
_PROTOTYPE( void sys_call_restart, (struct proc *caller) );
|
_PROTOTYPE( void sys_call_restart, (struct proc *caller) );
|
||||||
_PROTOTYPE( int lock_notify, (int src, int dst) );
|
_PROTOTYPE( int lock_notify, (int src, int dst) );
|
||||||
_PROTOTYPE( int lock_send, (int dst, message *m_ptr) );
|
_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 enqueue, (struct proc *rp) );
|
||||||
_PROTOTYPE( void dequeue, (struct proc *rp) );
|
_PROTOTYPE( void dequeue, (struct proc *rp) );
|
||||||
_PROTOTYPE( void balance_queues, (struct timer *tp) );
|
_PROTOTYPE( void balance_queues, (struct timer *tp) );
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ PUBLIC void sys_task()
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
{
|
{
|
||||||
|
struct proc *stp;
|
||||||
static int prevu;
|
static int prevu;
|
||||||
int u, dt;
|
int u, dt;
|
||||||
u = get_uptime();
|
u = get_uptime();
|
||||||
|
|
@ -113,6 +114,18 @@ PUBLIC void sys_task()
|
||||||
npagefaults = 0;
|
npagefaults = 0;
|
||||||
vmreqs = 0;
|
vmreqs = 0;
|
||||||
prevu = u;
|
prevu = u;
|
||||||
|
#if DEBUG_TRACE
|
||||||
|
for (stp = BEG_PROC_ADDR; stp < END_PROC_ADDR; stp++) {
|
||||||
|
int ps = PERSEC(stp->p_schedules);
|
||||||
|
if(isemptyp(stp))
|
||||||
|
continue;
|
||||||
|
if(ps > 10) {
|
||||||
|
printf("%s %d ", stp->p_name, ps);
|
||||||
|
stp->p_schedules = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user