callout(9): add sbt flavors of callout_schedule

Differential Revision:	https://reviews.freebsd.org/D1161 (partial)
Reviewed by:	jhb, markj
MFC after:	1 week
This commit is contained in:
Andriy Gapon 2014-11-25 15:21:21 +00:00
parent ac071896d1
commit 088b124ba7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=275045
3 changed files with 30 additions and 4 deletions

View File

@ -1576,12 +1576,16 @@ MLINKS+=timeout.9 callout.9 \
timeout.9 callout_pending.9 \
timeout.9 callout_reset.9 \
timeout.9 callout_reset_curcpu.9 \
timeout.9 callout_reset_sbt.9 \
timeout.9 callout_reset_on.9 \
timeout.9 callout_reset_sbt.9 \
timeout.9 callout_reset_sbt_curcpu.9 \
timeout.9 callout_reset_sbt_on.9 \
timeout.9 callout_schedule.9 \
timeout.9 callout_schedule_curcpu.9 \
timeout.9 callout_schedule_on.9 \
timeout.9 callout_schedule_sbt.9 \
timeout.9 callout_schedule_sbt_curcpu.9 \
timeout.9 callout_schedule_sbt_on.9 \
timeout.9 callout_stop.9 \
timeout.9 untimeout.9
MLINKS+=ucred.9 cred_update_thread.9 \

View File

@ -51,6 +51,9 @@
.Nm callout_schedule ,
.Nm callout_schedule_curcpu ,
.Nm callout_schedule_on ,
.Nm callout_schedule_sbt ,
.Nm callout_schedule_sbt_curcpu ,
.Nm callout_schedule_sbt_on ,
.Nm callout_stop ,
.Nm timeout ,
.Nm untimeout
@ -106,6 +109,15 @@ struct callout_handle handle = CALLOUT_HANDLE_INITIALIZER(&handle);
.Ft int
.Fn callout_schedule_on "struct callout *c" "int ticks" "int cpu"
.Ft int
.Fn callout_schedule_sbt "struct callout *c" "sbintime_t sbt" \
"sbintime_t pr" "int flags"
.Ft int
.Fn callout_schedule_sbt_curcpu "struct callout *c" "sbintime_t sbt" \
"sbintime_t pr" "int flags"
.Ft int
.Fn callout_schedule_sbt_on "struct callout *c" "sbintime_t sbt" \
"sbintime_t pr" "int cpu" "int flags"
.Ft int
.Fn callout_stop "struct callout *c"
.Ft struct callout_handle
.Fn timeout "timeout_t *func" "void *arg" "int ticks"
@ -386,21 +398,24 @@ callouts are assigned to CPU 0.
The
.Fn callout_reset_on ,
.Fn callout_reset_sbt_on ,
and
.Fn callout_schedule_on
and
.Fn callout_schedule_sbt_on
functions assign the callout to CPU
.Fa cpu .
The
.Fn callout_reset_curcpu ,
.Fn callout_reset_sbt_curpu ,
and
.Fn callout_schedule_curcpu
and
.Fn callout_schedule_sbt_curcpu
functions assign the callout to the current CPU.
The
.Fn callout_reset ,
.Fn callout_reset_sbt ,
and
.Fn callout_schedule
and
.Fn callout_schedule_sbt
functions schedule the callout to execute in the softclock thread of the CPU
to which it is currently assigned.
.Pp

View File

@ -91,6 +91,13 @@ int callout_reset_sbt_on(struct callout *, sbintime_t, sbintime_t,
callout_reset_on((c), (on_tick), (fn), (arg), (c)->c_cpu)
#define callout_reset_curcpu(c, on_tick, fn, arg) \
callout_reset_on((c), (on_tick), (fn), (arg), PCPU_GET(cpuid))
#define callout_schedule_sbt_on(c, sbt, pr, cpu, flags) \
callout_reset_sbt_on((c), (sbt), (pr), (c)->c_func, (c)->c_arg, \
(cpu), (flags))
#define callout_schedule_sbt(c, sbt, pr, flags) \
callout_schedule_sbt_on((c), (sbt), (pr), (c)->c_cpu, (flags))
#define callout_schedule_sbt_curcpu(c, sbt, pr, flags) \
callout_schedule_sbt_on((c), (sbt), (pr), PCPU_GET(cpuid), (flags))
int callout_schedule(struct callout *, int);
int callout_schedule_on(struct callout *, int, int);
#define callout_schedule_curcpu(c, on_tick) \