epoch.9 (7739f6e5ad31a5018e05775101dc1ebddff5c7c0) epoch.9 (68195696a6e7bfd7e14e1ee20d69b48c97abd8fc)
1.\"
2.\" Copyright (C) 2018 Matthew Macy <mmacy@FreeBSD.org>.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice(s), this list of conditions and the following disclaimer as

--- 35 unchanged lines hidden (view full) ---

44.In sys/param.h
45.In sys/proc.h
46.In sys/epoch.h
47.Ft epoch_t
48.Fn epoch_alloc "int flags"
49.Ft void
50.Fn epoch_enter "epoch_t epoch"
51.Ft void
1.\"
2.\" Copyright (C) 2018 Matthew Macy <mmacy@FreeBSD.org>.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice(s), this list of conditions and the following disclaimer as

--- 35 unchanged lines hidden (view full) ---

44.In sys/param.h
45.In sys/proc.h
46.In sys/epoch.h
47.Ft epoch_t
48.Fn epoch_alloc "int flags"
49.Ft void
50.Fn epoch_enter "epoch_t epoch"
51.Ft void
52.Fn epoch_enter_preempt "epoch_t epoch"
52.Fn epoch_enter_preempt "epoch_t epoch" "epoch_tracker_t et"
53.Ft void
54.Fn epoch_exit "epoch_t epoch"
55.Ft void
53.Ft void
54.Fn epoch_exit "epoch_t epoch"
55.Ft void
56.Fn epoch_exit_preempt "epoch_t epoch"
56.Fn epoch_exit_preempt "epoch_t epoch" "epoch_tracker_t et"
57.Ft void
58.Fn epoch_wait "epoch_t epoch"
59.Ft void
60.Fn epoch_wait_preempt "epoch_t epoch"
61.Ft void
62.Fn epoch_call "epoch_t epoch" "epoch_context_t ctx" "void (*callback) (epoch_context_t)"
63.Ft int
64.Fn in_epoch "void"

--- 34 unchanged lines hidden (view full) ---

99Only non-sleepable locks can be acquired during a section protected by
100.Fn epoch_enter_preempt
101and
102.Fn epoch_exit_preempt .
103INVARIANTS can assert that a thread is in an epoch by using
104.Fn in_epoch .
105.Pp
106The epoch API currently does not support sleeping in epoch_preempt sections.
57.Ft void
58.Fn epoch_wait "epoch_t epoch"
59.Ft void
60.Fn epoch_wait_preempt "epoch_t epoch"
61.Ft void
62.Fn epoch_call "epoch_t epoch" "epoch_context_t ctx" "void (*callback) (epoch_context_t)"
63.Ft int
64.Fn in_epoch "void"

--- 34 unchanged lines hidden (view full) ---

99Only non-sleepable locks can be acquired during a section protected by
100.Fn epoch_enter_preempt
101and
102.Fn epoch_exit_preempt .
103INVARIANTS can assert that a thread is in an epoch by using
104.Fn in_epoch .
105.Pp
106The epoch API currently does not support sleeping in epoch_preempt sections.
107A caller cannot do epoch_enter recursively on different preemptible epochs.
108A caller should never call
109.Fn epoch_wait
107A caller should never call
108.Fn epoch_wait
110in the middle of an epoch section as this will lead to a deadlock.
109in the middle of an epoch section for the same epoch as this will lead to a deadlock.
111.Pp
110.Pp
112Note that epochs are not a straight replacement for read locks.
111Be default mutexes cannot be held across
112.Fn epoch_wait_preempt .
113To permit this the epoch must be allocated with
114.Fn EPOCH_LOCKED .
115When doing this one must be cautious of creating a situation where a deadlock is
116possible. Note that epochs are not a straight replacement for read locks.
113Callers must use safe list and tailq traversal routines in an epoch (see ck_queue).
114When modifying a list referenced from an epoch section safe removal
115routines must be used and the caller can no longer modify a list entry
116in place.
117An item to be modified must be handled with copy on write
118and frees must be deferred until after a grace period has elapsed.
119.Sh RETURN VALUES
120.Fn in_epoch

--- 73 unchanged lines hidden ---
117Callers must use safe list and tailq traversal routines in an epoch (see ck_queue).
118When modifying a list referenced from an epoch section safe removal
119routines must be used and the caller can no longer modify a list entry
120in place.
121An item to be modified must be handled with copy on write
122and frees must be deferred until after a grace period has elapsed.
123.Sh RETURN VALUES
124.Fn in_epoch

--- 73 unchanged lines hidden ---