svn commit: r244284 - in projects/calloutng/sys: kern sys
Alexander Motin
mav at FreeBSD.org
Sun Dec 16 07:09:53 UTC 2012
Author: mav
Date: Sun Dec 16 07:09:52 2012
New Revision: 244284
URL: http://svnweb.freebsd.org/changeset/base/244284
Log:
- Remove c_staiter field from the struct callout and use c_links.tqe
instead. It is possible because callout can't be both on the callwheel and
the cc_expireq at the same time.
- Remove use of the cc_exec_next field. Since cc_expireq has no extra
elements we can always fetch first elements out of it and don't need to
keep pointer to the next one.
Modified:
projects/calloutng/sys/kern/kern_timeout.c
projects/calloutng/sys/sys/_callout.h
Modified: projects/calloutng/sys/kern/kern_timeout.c
==============================================================================
--- projects/calloutng/sys/kern/kern_timeout.c Sun Dec 16 01:20:08 2012 (r244283)
+++ projects/calloutng/sys/kern/kern_timeout.c Sun Dec 16 07:09:52 2012 (r244284)
@@ -384,7 +384,7 @@ void
callout_process(struct bintime *now)
{
struct bintime first, last, max, tmp_max;
- struct callout *tmp;
+ struct callout *tmp, *tmpn;
struct callout_cpu *cc;
struct callout_tailq *sc;
uint64_t lookahead;
@@ -450,12 +450,13 @@ callout_process(struct bintime *now)
NULL, 1);
tmp = cc->cc_exec_next_dir;
} else {
- TAILQ_INSERT_TAIL(&cc->cc_expireq,
- tmp, c_staiter);
+ tmpn = TAILQ_NEXT(tmp, c_links.tqe);
TAILQ_REMOVE(sc, tmp, c_links.tqe);
+ TAILQ_INSERT_TAIL(&cc->cc_expireq,
+ tmp, c_links.tqe);
tmp->c_flags |= CALLOUT_PROCESSED;
need_softclock = 1;
- tmp = TAILQ_NEXT(tmp, c_links.tqe);
+ tmp = tmpn;
}
continue;
}
@@ -789,15 +790,11 @@ softclock(void *arg)
gcalls = 0;
cc = (struct callout_cpu *)arg;
CC_LOCK(cc);
- c = TAILQ_FIRST(&cc->cc_expireq);
- while (c != NULL) {
- ++depth;
- cc->cc_exec_next = TAILQ_NEXT(c, c_staiter);
- TAILQ_REMOVE(&cc->cc_expireq, c, c_staiter);
+ while ((c = TAILQ_FIRST(&cc->cc_expireq)) != NULL) {
+ TAILQ_REMOVE(&cc->cc_expireq, c, c_links.tqe);
softclock_call_cc(c, cc, &mpcalls, &lockcalls, &gcalls, 0);
- c = cc->cc_exec_next;
+ ++depth;
}
- cc->cc_exec_next = NULL;
#ifdef CALLOUT_PROFILING
avg_depth += (depth * 1000 - avg_depth) >> 8;
avg_mpcalls += (mpcalls * 1000 - avg_mpcalls) >> 8;
@@ -962,11 +959,8 @@ _callout_reset_on(struct callout *c, str
bucket = get_bucket(&c->c_time);
TAILQ_REMOVE(&cc->cc_callwheel[bucket], c,
c_links.tqe);
- } else {
- if (cc->cc_exec_next == c)
- cc->cc_exec_next = TAILQ_NEXT(c, c_staiter);
- TAILQ_REMOVE(&cc->cc_expireq, c, c_staiter);
- }
+ } else
+ TAILQ_REMOVE(&cc->cc_expireq, c, c_links.tqe);
cancelled = 1;
c->c_flags &= ~(CALLOUT_ACTIVE | CALLOUT_PENDING);
}
@@ -1187,11 +1181,8 @@ again:
bucket = get_bucket(&c->c_time);
TAILQ_REMOVE(&cc->cc_callwheel[bucket], c,
c_links.tqe);
- } else {
- if (cc->cc_exec_next == c)
- cc->cc_exec_next = TAILQ_NEXT(c, c_links.tqe);
- TAILQ_REMOVE(&cc->cc_expireq, c, c_staiter);
- }
+ } else
+ TAILQ_REMOVE(&cc->cc_expireq, c, c_links.tqe);
callout_cc_del(c, cc);
CC_UNLOCK(cc);
Modified: projects/calloutng/sys/sys/_callout.h
==============================================================================
--- projects/calloutng/sys/sys/_callout.h Sun Dec 16 01:20:08 2012 (r244283)
+++ projects/calloutng/sys/sys/_callout.h Sun Dec 16 07:09:52 2012 (r244284)
@@ -51,7 +51,6 @@ struct callout {
SLIST_ENTRY(callout) sle;
TAILQ_ENTRY(callout) tqe;
} c_links;
- TAILQ_ENTRY(callout) c_staiter;
struct bintime c_time; /* ticks to the event */
struct bintime c_precision; /* delta allowed wrt opt */
void *c_arg; /* function argument */
More information about the svn-src-projects
mailing list