Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/kern/kern_mutex.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/kern/kern_mutex.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.43 retrieving revision 1.44 diff -u -p -r1.43 -r1.44 --- src/sys/kern/kern_mutex.c 2008/05/31 13:31:25 1.43 +++ src/sys/kern/kern_mutex.c 2008/10/15 06:51:20 1.44 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_mutex.c,v 1.43 2008/05/31 13:31:25 ad Exp $ */ +/* $NetBSD: kern_mutex.c,v 1.44 2008/10/15 06:51:20 wrstuden Exp $ */ /*- * Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #define __MUTEX_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.43 2008/05/31 13:31:25 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.44 2008/10/15 06:51:20 wrstuden Exp $"); #include #include @@ -59,6 +59,8 @@ __KERNEL_RCSID(0, "$NetBSD: kern_mutex.c #include +#include "opt_sa.h" + /* * When not running a debug kernel, spin mutexes are not much * more than an splraiseipl() and splx() pair. @@ -448,6 +450,9 @@ mutex_vector_enter(kmutex_t *mtx) struct cpu_info *ci = NULL; u_int count; #endif +#ifdef KERN_SA + int f; +#endif LOCKSTAT_COUNTER(spincnt); LOCKSTAT_COUNTER(slpcnt); LOCKSTAT_TIMER(spintime); @@ -680,6 +685,16 @@ mutex_vector_enter(kmutex_t *mtx) } #endif /* MULTIPROCESSOR */ +#ifdef KERN_SA + /* + * Sleeping for a mutex should not generate an upcall. + * So set LP_SA_NOBLOCK to indicate this. + * f indicates if we should clear LP_SA_NOBLOCK when done. + */ + f = ~curlwp->l_pflag & LP_SA_NOBLOCK; + curlwp->l_pflag |= LP_SA_NOBLOCK; +#endif /* KERN_SA */ + LOCKSTAT_START_TIMER(lsflag, slptime); turnstile_block(ts, TS_WRITER_Q, mtx, &mutex_syncobj); @@ -687,6 +702,10 @@ mutex_vector_enter(kmutex_t *mtx) LOCKSTAT_STOP_TIMER(lsflag, slptime); LOCKSTAT_COUNT(slpcnt, 1); +#ifdef KERN_SA + curlwp->l_pflag ^= f; +#endif /* KERN_SA */ + owner = mtx->mtx_owner; }