From f4245a50274882dca7b57baa470156b4519ccb49 Mon Sep 17 00:00:00 2001 From: David Howells Date: Thu, 7 Dec 2006 11:33:26 +0000 Subject: [PATCH] --- yaml --- r: 43903 b: refs/heads/master c: 4594bf159f1962cec3b727954b7c598b07e2e737 h: refs/heads/master i: 43901: a1960f5764a11887b5152d15696d4d9e2c674a39 43899: 476a93b6edbf6f4eb72e3efe6524340bed1c3483 43895: f40817b41af1b30fc0e635e05d8f82d06aabe776 43887: 1497bf9289af13fe8fb6a148a6cb2af48b6b7102 43871: 367d2cfd21c3a5c9ce12618c778cd2b4cc53c75a 43839: 42b5abd41203beb2a36e7607770b45c41b680d0c 43775: 561312cbfa4e0e6f1e27305c713331d2e449c370 v: v3 --- [refs] | 2 +- trunk/kernel/workqueue.c | 21 +++++++++------------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/[refs] b/[refs] index 5e3be379f836..464e4c17fb81 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d8a53b358257625778387925165eaa97839b2f52 +refs/heads/master: 4594bf159f1962cec3b727954b7c598b07e2e737 diff --git a/trunk/kernel/workqueue.c b/trunk/kernel/workqueue.c index 6b186750e9be..db49886bfae1 100644 --- a/trunk/kernel/workqueue.c +++ b/trunk/kernel/workqueue.c @@ -85,22 +85,19 @@ static inline int is_single_threaded(struct workqueue_struct *wq) return list_empty(&wq->list); } +/* + * Set the workqueue on which a work item is to be run + * - Must *only* be called if the pending flag is set + */ static inline void set_wq_data(struct work_struct *work, void *wq) { - unsigned long new, old, res; + unsigned long new; + + BUG_ON(!work_pending(work)); - /* assume the pending flag is already set and that the task has already - * been queued on this workqueue */ new = (unsigned long) wq | (1UL << WORK_STRUCT_PENDING); - res = work->management; - if (res != new) { - do { - old = res; - new = (unsigned long) wq; - new |= (old & WORK_STRUCT_FLAG_MASK); - res = cmpxchg(&work->management, old, new); - } while (res != old); - } + new |= work->management & WORK_STRUCT_FLAG_MASK; + work->management = new; } static inline void *get_wq_data(struct work_struct *work)