diff options
Diffstat (limited to 'include/linux/percpu-refcount.h')
-rw-r--r-- | include/linux/percpu-refcount.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h index 864d167a1073..009cdf3d65b6 100644 --- a/include/linux/percpu-refcount.h +++ b/include/linux/percpu-refcount.h | |||
@@ -30,10 +30,14 @@ | |||
30 | * calls io_destroy() or the process exits. | 30 | * calls io_destroy() or the process exits. |
31 | * | 31 | * |
32 | * In the aio code, kill_ioctx() is called when we wish to destroy a kioctx; it | 32 | * In the aio code, kill_ioctx() is called when we wish to destroy a kioctx; it |
33 | * calls percpu_ref_kill(), then hlist_del_rcu() and synchronize_rcu() to remove | 33 | * removes the kioctx from the proccess's table of kioctxs and kills percpu_ref. |
34 | * the kioctx from the proccess's list of kioctxs - after that, there can't be | 34 | * After that, there can't be any new users of the kioctx (from lookup_ioctx()) |
35 | * any new users of the kioctx (from lookup_ioctx()) and it's then safe to drop | 35 | * and it's then safe to drop the initial ref with percpu_ref_put(). |
36 | * the initial ref with percpu_ref_put(). | 36 | * |
37 | * Note that the free path, free_ioctx(), needs to go through explicit call_rcu() | ||
38 | * to synchronize with RCU protected lookup_ioctx(). percpu_ref operations don't | ||
39 | * imply RCU grace periods of any kind and if a user wants to combine percpu_ref | ||
40 | * with RCU protection, it must be done explicitly. | ||
37 | * | 41 | * |
38 | * Code that does a two stage shutdown like this often needs some kind of | 42 | * Code that does a two stage shutdown like this often needs some kind of |
39 | * explicit synchronization to ensure the initial refcount can only be dropped | 43 | * explicit synchronization to ensure the initial refcount can only be dropped |
@@ -113,8 +117,10 @@ void percpu_ref_reinit(struct percpu_ref *ref); | |||
113 | * Must be used to drop the initial ref on a percpu refcount; must be called | 117 | * Must be used to drop the initial ref on a percpu refcount; must be called |
114 | * precisely once before shutdown. | 118 | * precisely once before shutdown. |
115 | * | 119 | * |
116 | * Puts @ref in non percpu mode, then does a call_rcu() before gathering up the | 120 | * Switches @ref into atomic mode before gathering up the percpu counters |
117 | * percpu counters and dropping the initial ref. | 121 | * and dropping the initial ref. |
122 | * | ||
123 | * There are no implied RCU grace periods between kill and release. | ||
118 | */ | 124 | */ |
119 | static inline void percpu_ref_kill(struct percpu_ref *ref) | 125 | static inline void percpu_ref_kill(struct percpu_ref *ref) |
120 | { | 126 | { |