aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/workqueue.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-08-21 16:18:24 -0400
committerTejun Heo <tj@kernel.org>2012-08-21 16:18:24 -0400
commite0aecdd874d78b7129a64b056c20e529e2c916df (patch)
tree0eacde209b1f46beb5293537c85ab8217c7023f4 /include/linux/workqueue.h
parentf991b318cc6627a493b0d317a565bb7c3271f36b (diff)
workqueue: use irqsafe timer for delayed_work
Up to now, for delayed_works, try_to_grab_pending() couldn't be used from IRQ handlers because IRQs may happen while delayed_work_timer_fn() is in progress leading to indefinite -EAGAIN. This patch makes delayed_work use the new TIMER_IRQSAFE flag for delayed_work->timer. This makes try_to_grab_pending() and thus mod_delayed_work_on() safe to call from IRQ handlers. Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux/workqueue.h')
-rw-r--r--include/linux/workqueue.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index e84ebb69607..d86b320319e 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -136,7 +136,8 @@ struct execute_work {
136#define __DELAYED_WORK_INITIALIZER(n, f, tflags) { \ 136#define __DELAYED_WORK_INITIALIZER(n, f, tflags) { \
137 .work = __WORK_INITIALIZER((n).work, (f)), \ 137 .work = __WORK_INITIALIZER((n).work, (f)), \
138 .timer = __TIMER_INITIALIZER(delayed_work_timer_fn, \ 138 .timer = __TIMER_INITIALIZER(delayed_work_timer_fn, \
139 0, (unsigned long)&(n), (tflags)), \ 139 0, (unsigned long)&(n), \
140 (tflags) | TIMER_IRQSAFE), \
140 } 141 }
141 142
142#define DECLARE_WORK(n, f) \ 143#define DECLARE_WORK(n, f) \
@@ -214,7 +215,8 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
214 do { \ 215 do { \
215 INIT_WORK(&(_work)->work, (_func)); \ 216 INIT_WORK(&(_work)->work, (_func)); \
216 __setup_timer(&(_work)->timer, delayed_work_timer_fn, \ 217 __setup_timer(&(_work)->timer, delayed_work_timer_fn, \
217 (unsigned long)(_work), (_tflags)); \ 218 (unsigned long)(_work), \
219 (_tflags) | TIMER_IRQSAFE); \
218 } while (0) 220 } while (0)
219 221
220#define __INIT_DELAYED_WORK_ONSTACK(_work, _func, _tflags) \ 222#define __INIT_DELAYED_WORK_ONSTACK(_work, _func, _tflags) \
@@ -223,7 +225,7 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
223 __setup_timer_on_stack(&(_work)->timer, \ 225 __setup_timer_on_stack(&(_work)->timer, \
224 delayed_work_timer_fn, \ 226 delayed_work_timer_fn, \
225 (unsigned long)(_work), \ 227 (unsigned long)(_work), \
226 (_tflags)); \ 228 (_tflags) | TIMER_IRQSAFE); \
227 } while (0) 229 } while (0)
228 230
229#define INIT_DELAYED_WORK(_work, _func) \ 231#define INIT_DELAYED_WORK(_work, _func) \