From 54bc7f013030e60ef0e9fa59e04552941cc2eca0 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 12 Mar 1999 17:49:38 +0000 Subject: in scheduler, bias parents for child cpu usage; ross@ghs.com --- sys/kern/kern_exit.c | 6 +++++- sys/kern/kern_fork.c | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'sys') diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 245e6c62015..e12833d2947 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.16 1999/03/02 22:19:09 niklas Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.17 1999/03/12 17:49:37 deraadt Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -368,6 +368,10 @@ loop: wakeup((caddr_t)t); return (0); } + + /* Charge us for our child's sins */ + curproc->p_estcpu = min(curproc->p_estcpu + + p->p_estcpu, UCHAR_MAX); p->p_xstat = 0; ruadd(&q->p_stats->p_cru, p->p_ru); FREE(p->p_ru, M_ZOMBIE); diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 55cf72ce782..75e138eb8ca 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.19 1999/03/02 22:19:08 niklas Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.20 1999/03/12 17:49:37 deraadt Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -297,6 +297,13 @@ again: } #endif + /* + * set priority of child to be that of parent + * XXX should move p_estcpu into the region of struct proc which gets + * copied. + */ + p2->p_estcpu = p1->p_estcpu; + /* * This begins the section where we must prevent the parent * from being swapped. -- cgit v1.2.3