diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index faf233a8bd55..162f7130118e 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_synch.c,v 1.150 2005/10/02 17:51:27 chs Exp $ */ +/* $NetBSD: kern_synch.c,v 1.151 2005/10/06 07:02:14 yamt Exp $ */ /*- * Copyright (c) 1999, 2000, 2004 The NetBSD Foundation, Inc. @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.150 2005/10/02 17:51:27 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.151 2005/10/06 07:02:14 yamt Exp $"); #include "opt_ddb.h" #include "opt_ktrace.h" @@ -1191,6 +1191,31 @@ suspendsched() proclist_unlock_read(); } +/* + * scheduler_fork_hook: + * + * Inherit the parent's scheduler history. + */ +void +scheduler_fork_hook(struct proc *parent, struct proc *child) +{ + + child->p_estcpu = parent->p_estcpu; +} + +/* + * scheduler_wait_hook: + * + * Chargeback parents for the sins of their children. + */ +void +scheduler_wait_hook(struct proc *parent, struct proc *child) +{ + + /* XXX Only if parent != init?? */ + parent->p_estcpu = ESTCPULIM(parent->p_estcpu + child->p_estcpu); +} + /* * Low-level routines to access the run queue. Optimised assembler * routines can override these. diff --git a/sys/sys/sched.h b/sys/sys/sched.h index 1e34f3afc913..e9fe629e7e09 100644 --- a/sys/sys/sched.h +++ b/sys/sys/sched.h @@ -1,4 +1,4 @@ -/* $NetBSD: sched.h,v 1.21 2005/05/29 21:19:12 christos Exp $ */ +/* $NetBSD: sched.h,v 1.22 2005/10/06 07:02:13 yamt Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002 The NetBSD Foundation, Inc. @@ -206,27 +206,8 @@ void schedclock(struct lwp *); void sched_wakeup(__volatile const void *); void roundrobin(struct cpu_info *); -/* - * scheduler_fork_hook: - * - * Inherit the parent's scheduler history. - */ -#define scheduler_fork_hook(parent, child) \ -do { \ - (child)->p_estcpu = (parent)->p_estcpu; \ -} while (/* CONSTCOND */ 0) - -/* - * scheduler_wait_hook: - * - * Chargeback parents for the sins of their children. - */ -#define scheduler_wait_hook(parent, child) \ -do { \ - /* XXX Only if parent != init?? */ \ - (parent)->p_estcpu = ESTCPULIM((parent)->p_estcpu + \ - (child)->p_estcpu); \ -} while (/* CONSTCOND */ 0) +void scheduler_fork_hook(struct proc *, struct proc *); +void scheduler_wait_hook(struct proc *, struct proc *); #if defined(MULTIPROCESSOR) || defined(LOCKDEBUG) #include