diff options
author | Tejun Heo <tj@kernel.org> | 2012-08-03 13:30:44 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2012-08-03 13:30:44 -0400 |
commit | 0a13c00e9d4502b8e3fd9260ce781758ff2c3970 (patch) | |
tree | 4233ef42fad89b4c42e00d8fed76112ce28390ba /kernel | |
parent | 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee (diff) |
workqueue: reorder queueing functions so that _on() variants are on top
Currently, queue/schedule[_delayed]_work_on() are located below the
counterpart without the _on postifx even though the latter is usually
implemented using the former. Swap them.
This is cleanup and doesn't cause any functional difference.
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/workqueue.c | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 692d97628a10..07d309e7e359 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -1053,27 +1053,6 @@ static void __queue_work(unsigned int cpu, struct workqueue_struct *wq, | |||
1053 | } | 1053 | } |
1054 | 1054 | ||
1055 | /** | 1055 | /** |
1056 | * queue_work - queue work on a workqueue | ||
1057 | * @wq: workqueue to use | ||
1058 | * @work: work to queue | ||
1059 | * | ||
1060 | * Returns 0 if @work was already on a queue, non-zero otherwise. | ||
1061 | * | ||
1062 | * We queue the work to the CPU on which it was submitted, but if the CPU dies | ||
1063 | * it can be processed by another CPU. | ||
1064 | */ | ||
1065 | int queue_work(struct workqueue_struct *wq, struct work_struct *work) | ||
1066 | { | ||
1067 | int ret; | ||
1068 | |||
1069 | ret = queue_work_on(get_cpu(), wq, work); | ||
1070 | put_cpu(); | ||
1071 | |||
1072 | return ret; | ||
1073 | } | ||
1074 | EXPORT_SYMBOL_GPL(queue_work); | ||
1075 | |||
1076 | /** | ||
1077 | * queue_work_on - queue work on specific cpu | 1056 | * queue_work_on - queue work on specific cpu |
1078 | * @cpu: CPU number to execute work on | 1057 | * @cpu: CPU number to execute work on |
1079 | * @wq: workqueue to use | 1058 | * @wq: workqueue to use |
@@ -1097,31 +1076,34 @@ queue_work_on(int cpu, struct workqueue_struct *wq, struct work_struct *work) | |||
1097 | } | 1076 | } |
1098 | EXPORT_SYMBOL_GPL(queue_work_on); | 1077 | EXPORT_SYMBOL_GPL(queue_work_on); |
1099 | 1078 | ||
1100 | static void delayed_work_timer_fn(unsigned long __data) | ||
1101 | { | ||
1102 | struct delayed_work *dwork = (struct delayed_work *)__data; | ||
1103 | struct cpu_workqueue_struct *cwq = get_work_cwq(&dwork->work); | ||
1104 | |||
1105 | __queue_work(smp_processor_id(), cwq->wq, &dwork->work); | ||
1106 | } | ||
1107 | |||
1108 | /** | 1079 | /** |
1109 | * queue_delayed_work - queue work on a workqueue after delay | 1080 | * queue_work - queue work on a workqueue |
1110 | * @wq: workqueue to use | 1081 | * @wq: workqueue to use |
1111 | * @dwork: delayable work to queue | 1082 | * @work: work to queue |
1112 | * @delay: number of jiffies to wait before queueing | ||
1113 | * | 1083 | * |
1114 | * Returns 0 if @work was already on a queue, non-zero otherwise. | 1084 | * Returns 0 if @work was already on a queue, non-zero otherwise. |
1085 | * | ||
1086 | * We queue the work to the CPU on which it was submitted, but if the CPU dies | ||
1087 | * it can be processed by another CPU. | ||
1115 | */ | 1088 | */ |
1116 | int queue_delayed_work(struct workqueue_struct *wq, | 1089 | int queue_work(struct workqueue_struct *wq, struct work_struct *work) |
1117 | struct delayed_work *dwork, unsigned long delay) | ||
1118 | { | 1090 | { |
1119 | if (delay == 0) | 1091 | int ret; |
1120 | return queue_work(wq, &dwork->work); | ||
1121 | 1092 | ||
1122 | return queue_delayed_work_on(-1, wq, dwork, delay); | 1093 | ret = queue_work_on(get_cpu(), wq, work); |
1094 | put_cpu(); | ||
1095 | |||
1096 | return ret; | ||
1097 | } | ||
1098 | EXPORT_SYMBOL_GPL(queue_work); | ||
1099 | |||
1100 | static void delayed_work_timer_fn(unsigned long __data) | ||
1101 | { | ||
1102 | struct delayed_work *dwork = (struct delayed_work *)__data; | ||
1103 | struct cpu_workqueue_struct *cwq = get_work_cwq(&dwork->work); | ||
1104 | |||
1105 | __queue_work(smp_processor_id(), cwq->wq, &dwork->work); | ||
1123 | } | 1106 | } |
1124 | EXPORT_SYMBOL_GPL(queue_delayed_work); | ||
1125 | 1107 | ||
1126 | /** | 1108 | /** |
1127 | * queue_delayed_work_on - queue work on specific CPU after delay | 1109 | * queue_delayed_work_on - queue work on specific CPU after delay |
@@ -1179,6 +1161,24 @@ int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, | |||
1179 | EXPORT_SYMBOL_GPL(queue_delayed_work_on); | 1161 | EXPORT_SYMBOL_GPL(queue_delayed_work_on); |
1180 | 1162 | ||
1181 | /** | 1163 | /** |
1164 | * queue_delayed_work - queue work on a workqueue after delay | ||
1165 | * @wq: workqueue to use | ||
1166 | * @dwork: delayable work to queue | ||
1167 | * @delay: number of jiffies to wait before queueing | ||
1168 | * | ||
1169 | * Returns 0 if @work was already on a queue, non-zero otherwise. | ||
1170 | */ | ||
1171 | int queue_delayed_work(struct workqueue_struct *wq, | ||
1172 | struct delayed_work *dwork, unsigned long delay) | ||
1173 | { | ||
1174 | if (delay == 0) | ||
1175 | return queue_work(wq, &dwork->work); | ||
1176 | |||
1177 | return queue_delayed_work_on(-1, wq, dwork, delay); | ||
1178 | } | ||
1179 | EXPORT_SYMBOL_GPL(queue_delayed_work); | ||
1180 | |||
1181 | /** | ||
1182 | * worker_enter_idle - enter idle state | 1182 | * worker_enter_idle - enter idle state |
1183 | * @worker: worker which is entering idle state | 1183 | * @worker: worker which is entering idle state |
1184 | * | 1184 | * |
@@ -2877,6 +2877,19 @@ bool cancel_delayed_work_sync(struct delayed_work *dwork) | |||
2877 | } | 2877 | } |
2878 | EXPORT_SYMBOL(cancel_delayed_work_sync); | 2878 | EXPORT_SYMBOL(cancel_delayed_work_sync); |
2879 | 2879 | ||
2880 | /* | ||
2881 | * schedule_work_on - put work task on a specific cpu | ||
2882 | * @cpu: cpu to put the work task on | ||
2883 | * @work: job to be done | ||
2884 | * | ||
2885 | * This puts a job on a specific cpu | ||
2886 | */ | ||
2887 | int schedule_work_on(int cpu, struct work_struct *work) | ||
2888 | { | ||
2889 | return queue_work_on(cpu, system_wq, work); | ||
2890 | } | ||
2891 | EXPORT_SYMBOL(schedule_work_on); | ||
2892 | |||
2880 | /** | 2893 | /** |
2881 | * schedule_work - put work task in global workqueue | 2894 | * schedule_work - put work task in global workqueue |
2882 | * @work: job to be done | 2895 | * @work: job to be done |
@@ -2894,18 +2907,21 @@ int schedule_work(struct work_struct *work) | |||
2894 | } | 2907 | } |
2895 | EXPORT_SYMBOL(schedule_work); | 2908 | EXPORT_SYMBOL(schedule_work); |
2896 | 2909 | ||
2897 | /* | 2910 | /** |
2898 | * schedule_work_on - put work task on a specific cpu | 2911 | * schedule_delayed_work_on - queue work in global workqueue on CPU after delay |
2899 | * @cpu: cpu to put the work task on | 2912 | * @cpu: cpu to use |
2900 | * @work: job to be done | 2913 | * @dwork: job to be done |
2914 | * @delay: number of jiffies to wait | ||
2901 | * | 2915 | * |
2902 | * This puts a job on a specific cpu | 2916 | * After waiting for a given time this puts a job in the kernel-global |
2917 | * workqueue on the specified CPU. | ||
2903 | */ | 2918 | */ |
2904 | int schedule_work_on(int cpu, struct work_struct *work) | 2919 | int schedule_delayed_work_on(int cpu, |
2920 | struct delayed_work *dwork, unsigned long delay) | ||
2905 | { | 2921 | { |
2906 | return queue_work_on(cpu, system_wq, work); | 2922 | return queue_delayed_work_on(cpu, system_wq, dwork, delay); |
2907 | } | 2923 | } |
2908 | EXPORT_SYMBOL(schedule_work_on); | 2924 | EXPORT_SYMBOL(schedule_delayed_work_on); |
2909 | 2925 | ||
2910 | /** | 2926 | /** |
2911 | * schedule_delayed_work - put work task in global workqueue after delay | 2927 | * schedule_delayed_work - put work task in global workqueue after delay |
@@ -2923,22 +2939,6 @@ int schedule_delayed_work(struct delayed_work *dwork, | |||
2923 | EXPORT_SYMBOL(schedule_delayed_work); | 2939 | EXPORT_SYMBOL(schedule_delayed_work); |
2924 | 2940 | ||
2925 | /** | 2941 | /** |
2926 | * schedule_delayed_work_on - queue work in global workqueue on CPU after delay | ||
2927 | * @cpu: cpu to use | ||
2928 | * @dwork: job to be done | ||
2929 | * @delay: number of jiffies to wait | ||
2930 | * | ||
2931 | * After waiting for a given time this puts a job in the kernel-global | ||
2932 | * workqueue on the specified CPU. | ||
2933 | */ | ||
2934 | int schedule_delayed_work_on(int cpu, | ||
2935 | struct delayed_work *dwork, unsigned long delay) | ||
2936 | { | ||
2937 | return queue_delayed_work_on(cpu, system_wq, dwork, delay); | ||
2938 | } | ||
2939 | EXPORT_SYMBOL(schedule_delayed_work_on); | ||
2940 | |||
2941 | /** | ||
2942 | * schedule_on_each_cpu - execute a function synchronously on each online CPU | 2942 | * schedule_on_each_cpu - execute a function synchronously on each online CPU |
2943 | * @func: the function to call | 2943 | * @func: the function to call |
2944 | * | 2944 | * |