Merge want_ast check in userret() into trap handler, and repeat

preempt() call while want_resched is true.  While there remove
unnecessary #if 1.

This should fix a performance degradation of disk I/O on heavy load.
This commit is contained in:
nakayama 2009-10-17 08:50:49 +00:00
parent 1a80e629b5
commit 33ec454f0c
2 changed files with 9 additions and 15 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: userret.h,v 1.8 2008/06/30 14:12:20 nakayama Exp $ */
/* $NetBSD: userret.h,v 1.9 2009/10/17 08:50:49 nakayama Exp $ */
/*
* Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved.
@ -63,14 +63,6 @@ userret(struct lwp *l, int pc, u_quad_t oticks)
mi_userret(l);
if (want_ast) {
want_ast = 0;
if (l->l_pflag & LP_OWEUPC) {
l->l_pflag &= ~LP_OWEUPC;
ADDUPROF(l);
}
}
/*
* If profiling, charge recent system time to the trapped pc.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.157 2009/05/16 19:15:34 nakayama Exp $ */
/* $NetBSD: trap.c,v 1.158 2009/10/17 08:50:49 nakayama Exp $ */
/*
* Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved.
@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.157 2009/05/16 19:15:34 nakayama Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.158 2009/10/17 08:50:49 nakayama Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@ -608,12 +608,14 @@ badtrap:
#endif
case T_AST:
#if 1
if (want_resched)
if (l->l_pflag & LP_OWEUPC) {
l->l_pflag &= ~LP_OWEUPC;
ADDUPROF(l);
}
while (want_resched)
preempt();
want_ast = 0;
#endif
break; /* the work is all in userret() */
break;
case T_ILLINST:
case T_INST_EXCEPT: