Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern No need to lock the selcluster in selscan() if either
details: https://anonhg.NetBSD.org/src/rev/bafbe8edb549
branches: trunk
changeset: 768112:bafbe8edb549
user: hannken <hannken%NetBSD.org@localhost>
date: Tue Aug 09 06:36:51 2011 +0000
description:
No need to lock the selcluster in selscan() if either
NO_DIRECT_SELECT is defined or all polls return an event.
diffstat:
sys/kern/sys_select.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diffs (47 lines):
diff -r 5e3d6ba9f489 -r bafbe8edb549 sys/kern/sys_select.c
--- a/sys/kern/sys_select.c Tue Aug 09 04:19:17 2011 +0000
+++ b/sys/kern/sys_select.c Tue Aug 09 06:36:51 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_select.c,v 1.34 2011/08/06 11:04:25 hannken Exp $ */
+/* $NetBSD: sys_select.c,v 1.35 2011/08/09 06:36:51 hannken Exp $ */
/*-
* Copyright (c) 2007, 2008, 2009, 2010 The NetBSD Foundation, Inc.
@@ -84,7 +84,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_select.c,v 1.34 2011/08/06 11:04:25 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_select.c,v 1.35 2011/08/09 06:36:51 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -390,7 +390,7 @@
for (i = 0; i < nfd; i += NFDBITS) {
fd_mask ibits, obits;
- ibits = *ibitp++;
+ ibits = *ibitp;
obits = 0;
while ((j = ffs(ibits)) && (fd = i + --j) < nfd) {
ibits &= ~(1 << j);
@@ -408,10 +408,17 @@
fd_putfile(fd);
}
if (obits != 0) {
- mutex_spin_enter(lock);
+#ifndef NO_DIRECT_SELECT
+ if (obits != *ibitp)
+ mutex_spin_enter(lock);
*obitp |= obits;
- mutex_spin_exit(lock);
+ if (obits != *ibitp)
+ mutex_spin_exit(lock);
+#else
+ *obitp |= obits;
+#endif
}
+ ibitp++;
obitp++;
}
}
Home |
Main Index |
Thread Index |
Old Index