aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/workqueue.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-04-03 21:00:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-03 21:00:13 -0400
commitd92cd810e64aa7cf22b05f0ea1c7d3e8dbae75fe (patch)
tree592e040010a30d1dbce4e54eb597011af0df290e /include/linux/workqueue.h
parenta23867f1d2de572f84b459651dfe99fa9e79fadf (diff)
parentf75da8a8a918d7c343a2ec95d1ed99e5689e0f23 (diff)
Merge branch 'for-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
Pull workqueue updates from Tejun Heo: "rcu_work addition and a couple trivial changes" * 'for-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq: workqueue: remove the comment about the old manager_arb mutex workqueue: fix the comments of nr_idle fs/aio: Use rcu_work instead of explicit rcu and work item cgroup: Use rcu_work instead of explicit rcu and work item RCU, workqueue: Implement rcu_work
Diffstat (limited to 'include/linux/workqueue.h')
-rw-r--r--include/linux/workqueue.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 0c3301421c57..39a0e215022a 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -13,6 +13,7 @@
13#include <linux/threads.h> 13#include <linux/threads.h>
14#include <linux/atomic.h> 14#include <linux/atomic.h>
15#include <linux/cpumask.h> 15#include <linux/cpumask.h>
16#include <linux/rcupdate.h>
16 17
17struct workqueue_struct; 18struct workqueue_struct;
18 19
@@ -120,6 +121,14 @@ struct delayed_work {
120 int cpu; 121 int cpu;
121}; 122};
122 123
124struct rcu_work {
125 struct work_struct work;
126 struct rcu_head rcu;
127
128 /* target workqueue ->rcu uses to queue ->work */
129 struct workqueue_struct *wq;
130};
131
123/** 132/**
124 * struct workqueue_attrs - A struct for workqueue attributes. 133 * struct workqueue_attrs - A struct for workqueue attributes.
125 * 134 *
@@ -151,6 +160,11 @@ static inline struct delayed_work *to_delayed_work(struct work_struct *work)
151 return container_of(work, struct delayed_work, work); 160 return container_of(work, struct delayed_work, work);
152} 161}
153 162
163static inline struct rcu_work *to_rcu_work(struct work_struct *work)
164{
165 return container_of(work, struct rcu_work, work);
166}
167
154struct execute_work { 168struct execute_work {
155 struct work_struct work; 169 struct work_struct work;
156}; 170};
@@ -266,6 +280,12 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
266#define INIT_DEFERRABLE_WORK_ONSTACK(_work, _func) \ 280#define INIT_DEFERRABLE_WORK_ONSTACK(_work, _func) \
267 __INIT_DELAYED_WORK_ONSTACK(_work, _func, TIMER_DEFERRABLE) 281 __INIT_DELAYED_WORK_ONSTACK(_work, _func, TIMER_DEFERRABLE)
268 282
283#define INIT_RCU_WORK(_work, _func) \
284 INIT_WORK(&(_work)->work, (_func))
285
286#define INIT_RCU_WORK_ONSTACK(_work, _func) \
287 INIT_WORK_ONSTACK(&(_work)->work, (_func))
288
269/** 289/**
270 * work_pending - Find out whether a work item is currently pending 290 * work_pending - Find out whether a work item is currently pending
271 * @work: The work item in question 291 * @work: The work item in question
@@ -447,6 +467,7 @@ extern bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
447 struct delayed_work *work, unsigned long delay); 467 struct delayed_work *work, unsigned long delay);
448extern bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq, 468extern bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq,
449 struct delayed_work *dwork, unsigned long delay); 469 struct delayed_work *dwork, unsigned long delay);
470extern bool queue_rcu_work(struct workqueue_struct *wq, struct rcu_work *rwork);
450 471
451extern void flush_workqueue(struct workqueue_struct *wq); 472extern void flush_workqueue(struct workqueue_struct *wq);
452extern void drain_workqueue(struct workqueue_struct *wq); 473extern void drain_workqueue(struct workqueue_struct *wq);
@@ -462,6 +483,8 @@ extern bool flush_delayed_work(struct delayed_work *dwork);
462extern bool cancel_delayed_work(struct delayed_work *dwork); 483extern bool cancel_delayed_work(struct delayed_work *dwork);
463extern bool cancel_delayed_work_sync(struct delayed_work *dwork); 484extern bool cancel_delayed_work_sync(struct delayed_work *dwork);
464 485
486extern bool flush_rcu_work(struct rcu_work *rwork);
487
465extern void workqueue_set_max_active(struct workqueue_struct *wq, 488extern void workqueue_set_max_active(struct workqueue_struct *wq,
466 int max_active); 489 int max_active);
467extern struct work_struct *current_work(void); 490extern struct work_struct *current_work(void);