Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/librump/rumpkern Avoid calling curcpu() when we kno...
details: https://anonhg.NetBSD.org/src/rev/85b3fa607215
branches: trunk
changeset: 791285:85b3fa607215
user: pooka <pooka%NetBSD.org@localhost>
date: Mon Nov 11 23:11:30 2013 +0000
description:
Avoid calling curcpu() when we know the result is constant.
diffstat:
sys/rump/librump/rumpkern/intr.c | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)
diffs (54 lines):
diff -r 1868046ea50e -r 85b3fa607215 sys/rump/librump/rumpkern/intr.c
--- a/sys/rump/librump/rumpkern/intr.c Mon Nov 11 23:06:40 2013 +0000
+++ b/sys/rump/librump/rumpkern/intr.c Mon Nov 11 23:11:30 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.c,v 1.41 2013/11/11 23:06:40 pooka Exp $ */
+/* $NetBSD: intr.c,v 1.42 2013/11/11 23:11:30 pooka Exp $ */
/*
* Copyright (c) 2008-2010 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.41 2013/11/11 23:06:40 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.42 2013/11/11 23:11:30 pooka Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -103,6 +103,7 @@
int64_t sec;
long nsec;
int error;
+ int cpuindx = curcpu()->ci_index;
extern int hz;
error = rumpuser_clock_gettime(RUMPUSER_CLOCK_ABSMONO, &sec, &nsec);
@@ -122,14 +123,8 @@
KASSERT(!error);
timespecadd(&curclock, &thetick, &curclock);
-#if 0
- /* CPU_IS_PRIMARY is MD and hence unreliably correct here */
- if (!CPU_IS_PRIMARY(curcpu()))
+ if (cpuindx != 0)
continue;
-#else
- if (curcpu()->ci_index != 0)
- continue;
-#endif
if ((++ticks % hz) == 0) {
cv_broadcast(&lbolt);
@@ -313,8 +308,9 @@
softint_schedule(void *arg)
{
struct softint *si = arg;
- struct softint_percpu *sip = &si->si_entry[curcpu()->ci_index];
- struct cpu_data *cd = &curcpu()->ci_data;
+ struct cpu_info *ci = curcpu();
+ struct softint_percpu *sip = &si->si_entry[ci->ci_index];
+ struct cpu_data *cd = &ci->ci_data;
struct softint_lev *si_lvl = cd->cpu_softcpu;
if (!rump_threads) {
Home |
Main Index |
Thread Index |
Old Index