1FLUSH_SCHEDULED_WORK(9) Driver Basics FLUSH_SCHEDULED_WORK(9)
2
3
4
6 flush_scheduled_work - ensure that any scheduled work has run to
7 completion.
8
10 void flush_scheduled_work(void);
11
13 void
14 no arguments
15
17 Forces execution of the kernel-global workqueue and blocks until its
18 completion.
19
20 Think twice before calling this function! It's very easy to get into
21 trouble if you don't take great care. Either of the following
22 situations
23
25 One of the work items currently on the workqueue needs to acquire a
26 lock held by your code or its caller.
27
28 Your code is running in the context of a work routine.
29
30 They will be detected by lockdep when they occur, but the first might
31 not occur very often. It depends on what work items are on the
32 workqueue and what locks they need, which you have no control over.
33
34 In most situations flushing the entire workqueue is overkill; you
35 merely need to know that a particular work item isn't queued and isn't
36 running. In such cases you should use cancel_delayed_work_sync or
37 cancel_work_sync instead.
38
40Kernel Hackers Manual 3.10 June 2019 FLUSH_SCHEDULED_WORK(9)