2009-07-30 17:32:38

by Bart Van Assche

[permalink] [raw]
Subject: [PATCH 2.6.30] schedule_work() documentation improvements

Two important aspects of the schedule_work() function are not yet documented:
- that it is allowed to pass a struct work_struct * to this function that
is already on the kernel-global workqueue;
- the meaning of its return value.
The patch below documents both aspects.

Signed-off-by: Bart Van Assche <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Ingo Molnar <[email protected]>

diff -uprN orig/linux-2.6.30/kernel/workqueue.c linux-2.6.30/kernel/workqueue.c
--- orig/linux-2.6.30/kernel/workqueue.c 2009-06-10 05:05:27.000000000 +0200
+++ linux-2.6.30/kernel/workqueue.c 2009-07-30 18:58:07.000000000 +0200
@@ -603,7 +603,11 @@ static struct workqueue_struct *keventd_
* schedule_work - put work task in global workqueue
* @work: job to be done
*
- * This puts a job in the kernel-global workqueue.
+ * Returns zero if @work was already on the kernel-global workqueue and
+ * non-zero otherwise.
+ *
+ * This puts a job in the kernel-global workqueue if it was not already queued
+ * and leaves it in the same position on the kernel-global workqueue otherwise.
*/
int schedule_work(struct work_struct *work)
{