diff options
Diffstat (limited to 'kernel/workqueue.c')
| -rw-r--r-- | kernel/workqueue.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index c66912be990f..b010eac595d2 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
| @@ -2851,19 +2851,6 @@ already_gone: | |||
| 2851 | return false; | 2851 | return false; |
| 2852 | } | 2852 | } |
| 2853 | 2853 | ||
| 2854 | static bool __flush_work(struct work_struct *work) | ||
| 2855 | { | ||
| 2856 | struct wq_barrier barr; | ||
| 2857 | |||
| 2858 | if (start_flush_work(work, &barr)) { | ||
| 2859 | wait_for_completion(&barr.done); | ||
| 2860 | destroy_work_on_stack(&barr.work); | ||
| 2861 | return true; | ||
| 2862 | } else { | ||
| 2863 | return false; | ||
| 2864 | } | ||
| 2865 | } | ||
| 2866 | |||
| 2867 | /** | 2854 | /** |
| 2868 | * flush_work - wait for a work to finish executing the last queueing instance | 2855 | * flush_work - wait for a work to finish executing the last queueing instance |
| 2869 | * @work: the work to flush | 2856 | * @work: the work to flush |
| @@ -2877,10 +2864,18 @@ static bool __flush_work(struct work_struct *work) | |||
| 2877 | */ | 2864 | */ |
| 2878 | bool flush_work(struct work_struct *work) | 2865 | bool flush_work(struct work_struct *work) |
| 2879 | { | 2866 | { |
| 2867 | struct wq_barrier barr; | ||
| 2868 | |||
| 2880 | lock_map_acquire(&work->lockdep_map); | 2869 | lock_map_acquire(&work->lockdep_map); |
| 2881 | lock_map_release(&work->lockdep_map); | 2870 | lock_map_release(&work->lockdep_map); |
| 2882 | 2871 | ||
| 2883 | return __flush_work(work); | 2872 | if (start_flush_work(work, &barr)) { |
| 2873 | wait_for_completion(&barr.done); | ||
| 2874 | destroy_work_on_stack(&barr.work); | ||
| 2875 | return true; | ||
| 2876 | } else { | ||
| 2877 | return false; | ||
| 2878 | } | ||
| 2884 | } | 2879 | } |
| 2885 | EXPORT_SYMBOL_GPL(flush_work); | 2880 | EXPORT_SYMBOL_GPL(flush_work); |
| 2886 | 2881 | ||
| @@ -4832,14 +4827,7 @@ long work_on_cpu(int cpu, long (*fn)(void *), void *arg) | |||
| 4832 | 4827 | ||
| 4833 | INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn); | 4828 | INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn); |
| 4834 | schedule_work_on(cpu, &wfc.work); | 4829 | schedule_work_on(cpu, &wfc.work); |
| 4835 | 4830 | flush_work(&wfc.work); | |
| 4836 | /* | ||
| 4837 | * The work item is on-stack and can't lead to deadlock through | ||
| 4838 | * flushing. Use __flush_work() to avoid spurious lockdep warnings | ||
| 4839 | * when work_on_cpu()s are nested. | ||
| 4840 | */ | ||
| 4841 | __flush_work(&wfc.work); | ||
| 4842 | |||
| 4843 | return wfc.ret; | 4831 | return wfc.ret; |
| 4844 | } | 4832 | } |
| 4845 | EXPORT_SYMBOL_GPL(work_on_cpu); | 4833 | EXPORT_SYMBOL_GPL(work_on_cpu); |
