svn commit: r236569 - in projects/calloutng/sys: kern sys
Davide Italiano
davide at FreeBSD.org
Mon Jun 4 17:10:03 UTC 2012
Author: davide
Date: Mon Jun 4 17:10:02 2012
New Revision: 236569
URL: http://svn.freebsd.org/changeset/base/236569
Log:
- Start to experiment an extension of the current KPI adding the
callout_reset_bt_on() in which we specify timeouts in terms of
struct bintime rather than ticks.
- Make the old callout_reset_on() just a wrapper to the new function.
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 Mon Jun 4 16:28:56 2012 (r236568)
+++ projects/calloutng/sys/kern/kern_timeout.c Mon Jun 4 17:10:02 2012 (r236569)
@@ -830,24 +830,14 @@ callout_handle_init(struct callout_handl
* callout_pending() - returns truth if callout is still waiting for timeout
* callout_deactivate() - marks the callout as having been serviced
*/
-int
-callout_reset_on(struct callout *c, int to_ticks, void (*ftn)(void *),
+int
+callout_reset_bt_on(struct callout *c, struct bintime bt, void (*ftn)(void *),
void *arg, int cpu)
{
struct callout_cpu *cc;
- struct bintime bt;
- struct bintime now;
int cancelled = 0;
- int bucket;
-
- /*
- * Convert ticks to struct bintime.
- */
+ int bucket;
- FREQ2BT(hz,&bt);
- getbinuptime(&now);
- bintime_mul(&bt,to_ticks);
- bintime_add(&bt,&now);
/*
* Don't allow migration of pre-allocated callouts lest they
* become unbalanced.
@@ -924,6 +914,19 @@ callout_reset_on(struct callout *c, int
return (cancelled);
}
+int
+callout_reset_on(struct callout *c, int to_ticks, void (*ftn)(void *),
+ void *arg, int cpu)
+{
+ struct bintime bt, now;
+
+ FREQ2BT(hz,&bt);
+ getbinuptime(&now);
+ bintime_mul(&bt,to_ticks);
+ bintime_add(&bt,&now);
+ return (callout_reset_bt_on(c, bt, ftn, arg, cpu));
+}
+
/*
* Common idioms that can be optimized in the future.
*/
Modified: projects/calloutng/sys/sys/callout.h
==============================================================================
--- projects/calloutng/sys/sys/callout.h Mon Jun 4 16:28:56 2012 (r236568)
+++ projects/calloutng/sys/sys/callout.h Mon Jun 4 17:10:02 2012 (r236569)
@@ -68,6 +68,8 @@ void _callout_init_lock(struct callout *
_callout_init_lock((c), ((rw) != NULL) ? &(rw)->lock_object : \
NULL, (flags))
#define callout_pending(c) ((c)->c_flags & CALLOUT_PENDING)
+int callout_reset_bt_on(struct callout *, struct bintime, void(*)(void *),
+ void *, int);
int callout_reset_on(struct callout *, int, void (*)(void *), void *, int);
#define callout_reset(c, on_tick, fn, arg) \
callout_reset_on((c), (on_tick), (fn), (arg), (c)->c_cpu)
More information about the svn-src-projects
mailing list