Skip to content

Commit

Permalink
workqueues: queue_work() can use queue_work_on()
Browse files Browse the repository at this point in the history
queue_work() can use queue_work_on() to avoid the code duplication.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Jul 25, 2008
1 parent a67da70 commit ef1ca23
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,11 @@ static void __queue_work(struct cpu_workqueue_struct *cwq,
*/
int queue_work(struct workqueue_struct *wq, struct work_struct *work)
{
int ret = 0;
int ret;

ret = queue_work_on(get_cpu(), wq, work);
put_cpu();

if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) {
BUG_ON(!list_empty(&work->entry));
__queue_work(wq_per_cpu(wq, get_cpu()), work);
put_cpu();
ret = 1;
}
return ret;
}
EXPORT_SYMBOL_GPL(queue_work);
Expand Down

0 comments on commit ef1ca23

Please sign in to comment.