From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Tejun Heo <tj@kernel.org>, linux-kernel@vger.kernel.org
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Subject: [PATCH 05/10] workqueue: add wq_dec_flusher_ref()
Date: Mon, 24 Sep 2012 18:07:07 +0800 [thread overview]
Message-ID: <1348481238-6138-6-git-send-email-laijs@cn.fujitsu.com> (raw)
In-Reply-To: <1348481238-6138-1-git-send-email-laijs@cn.fujitsu.com>
it is a helper to relase reference.
This patch doesn't make any functional difference.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
kernel/workqueue.c | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 861b4c7..e5ba08c 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -995,6 +995,16 @@ static void cwq_activate_first_delayed(struct cpu_workqueue_struct *cwq)
cwq_activate_delayed_work(work);
}
+static void wq_dec_flusher_ref(struct workqueue_struct *wq, int color)
+{
+ /*
+ * If this was the last reference, wake up the first flusher.
+ * It will handle the rest.
+ */
+ if (atomic_dec_and_test(&wq->nr_cwqs_to_flush[color]))
+ complete(&wq->first_flusher->done);
+}
+
/**
* cwq_dec_nr_in_flight - decrement cwq's nr_in_flight
* @cwq: cwq of interest
@@ -1032,12 +1042,7 @@ static void cwq_dec_nr_in_flight(struct cpu_workqueue_struct *cwq, int color)
/* this cwq is done, clear flush_color */
cwq->flush_color = -1;
- /*
- * If this was the last cwq, wake up the first flusher. It
- * will handle the rest.
- */
- if (atomic_dec_and_test(&cwq->wq->nr_cwqs_to_flush[color]))
- complete(&cwq->wq->first_flusher->done);
+ wq_dec_flusher_ref(cwq->wq, color);
}
/**
@@ -2594,9 +2599,8 @@ static bool flush_workqueue_prep_cwqs(struct workqueue_struct *wq,
spin_unlock_irq(&gcwq->lock);
}
- if (flush_color >= 0 &&
- atomic_dec_and_test(&wq->nr_cwqs_to_flush[flush_color]))
- complete(&wq->first_flusher->done);
+ if (flush_color >= 0)
+ wq_dec_flusher_ref(wq, flush_color);
return wait;
}
--
1.7.4.4
next prev parent reply other threads:[~2012-09-24 10:07 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-24 10:07 [PATCH 00/10] workqueue: restructure flush_workqueue() and start all flusher at the same time Lai Jiangshan
2012-09-24 10:07 ` [PATCH 01/10] workqueue: always pass flush responsibility to next Lai Jiangshan
2012-09-24 10:07 ` [PATCH 02/10] workqueue: remove unneeded check Lai Jiangshan
2012-09-24 10:07 ` [PATCH 03/10] workqueue: remove while(true) Lai Jiangshan
2012-09-24 10:07 ` [PATCH 04/10] workqueue: use nr_cwqs_to_flush array Lai Jiangshan
2012-09-24 10:07 ` Lai Jiangshan [this message]
2012-09-24 10:07 ` [PATCH 06/10] workqueue: start all flusher at the same time Lai Jiangshan
2012-09-24 10:07 ` [PATCH 07/10] workqueue: simplify flush_workqueue_prep_cwqs() Lai Jiangshan
2012-09-24 10:07 ` [PATCH 08/10] workqueue: assign overflowed flushers's flush color when queued Lai Jiangshan
2012-09-24 10:07 ` [PATCH 09/10] workqueue: remove flusher_overflow Lai Jiangshan
2012-09-24 10:07 ` [PATCH 10/10] workqueue: remove wq->flush_color Lai Jiangshan
2012-09-24 20:39 ` [PATCH 00/10] workqueue: restructure flush_workqueue() and start all flusher at the same time Tejun Heo
2012-09-25 9:02 ` Lai Jiangshan
2012-09-25 20:14 ` Tejun Heo
2012-09-25 9:02 ` Lai Jiangshan
2012-09-25 20:24 ` Tejun Heo
2012-09-26 4:48 ` Lai Jiangshan
2012-09-26 16:49 ` Tejun Heo
2012-09-26 17:04 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1348481238-6138-6-git-send-email-laijs@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®