From f4708cee467b0782e1c368734c62ff032aa24f6a Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 1 Sep 1998 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1998-09-01 --- ip/tcp.c | 2 +- port/proc.c | 59 ++++++++++++++++++++++++++------------------------ port/sysfile.c | 4 +++- 3 files changed, 35 insertions(+), 30 deletions(-) diff --git a/ip/tcp.c b/ip/tcp.c index 11444f04181397ee9e635324ab2413efb75e69b1..03ef95e88139bd6d1826ee9d137ab3d67d85f5f2 100644 --- a/ip/tcp.c +++ b/ip/tcp.c @@ -1509,7 +1509,7 @@ tcpoutput(Conv *s) sent = tcb->snd.ptr - tcb->snd.una; /* Don't send anything else until our SYN has been acked */ - if(sent != 0 && (tcb->flags & (SYNACK|FORCE)) == 0) + if(tcb->snd.ptr != tcb->iss && (tcb->flags & SYNACK) == 0) break; /* Compute usable segment based on offered window and limit diff --git a/port/proc.c b/port/proc.c index d9f8157bf918753edd06123ff56fca9109b153fe..033e7d36f42126f8e3c7923aebac8d336765ee89 100644 --- a/port/proc.c +++ b/port/proc.c @@ -186,9 +186,9 @@ ready(Proc *p) Proc* runproc(void) { - int i; - Schedq *rq; + Schedq *rq, *xrq; Proc *p, *l; + ulong rt; loop: @@ -198,41 +198,44 @@ loop: */ spllo(); for(;;){ - /* - * get lowest priority process that this - * processor can run given affinity constraints - * and that hasn't run in a while - */ - if((m->fairness++ & 3) == 0){ + if((++(m->fairness) & 3) == 0){ + /* + * once in a while, run process that's been waiting longest + * regardless of movetime + */ + rt = 0xffffffff; + xrq = nil; for(rq = runq; rq < &runq[Nrq]; rq++){ + p = rq->head; + if(p == 0) + continue; + if(p->readytime < rt){ + xrq = rq; + rt = p->readytime; + } + } + if(xrq != nil){ + rq = xrq; + p = rq->head; + if(p != nil) + p->movetime = 0; + } + } else { + /* + * get highest priority process that this + * processor can run given affinity constraints + */ + for(rq = &runq[Nrq-1]; rq >= runq; rq--){ p = rq->head; if(p == 0) continue; for(; p; p = p->rnext){ - if(p->mp != MACHP(m->machno)) - if(p->movetime >= m->ticks) - continue; - i = m->ticks - p->readytime; - if(i >= 2*nrdy*p->art) + if(p->mp == MACHP(m->machno) + || p->movetime < m->ticks) goto found; } } } - - /* - * get highest priority process that this - * processor can run given affinity constraints - */ - for(rq = &runq[Nrq-1]; rq >= runq; rq--){ - p = rq->head; - if(p == 0) - continue; - for(; p; p = p->rnext){ - if(p->mp == MACHP(m->machno) - || p->movetime < m->ticks) - goto found; - } - } } found: diff --git a/port/sysfile.c b/port/sysfile.c index a039e164c318efd211923f439d97095947eaea06..488e6163ec4beeb8e63a1de1e5b29f79cc42daf3 100644 --- a/port/sysfile.c +++ b/port/sysfile.c @@ -291,11 +291,13 @@ unionread(Chan *c, void *va, long n) for(i = 0; mount != nil && i < c->uri; i++) mount = mount->next; - for(;;) { + while(mount != nil) { if(waserror()) { runlock(&m->lock); nexterror(); } + if(mount->to == nil) + goto next; nc = cclone(mount->to, 0); poperror();