mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 3/8] workqueue: remove cpu_intensive from process_one_work()
Date: Mon, 15 Apr 2013 00:41:51 +0800	[thread overview]
Message-ID: <1365957716-7631-4-git-send-email-laijs@cn.fujitsu.com> (raw)
In-Reply-To: <1365957716-7631-1-git-send-email-laijs@cn.fujitsu.com>

In process_one_work(), we can use "worker->flags & WORKER_CPU_INTENSIVE"
instead "cpu_intensive" and because worker->flags is hot field
(accessed when process each work item). so this change will not cause
any performance down.

It prepare for also clearing WORKER_QUIT_CM in the same place.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 kernel/workqueue.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index d1e10c5..a4bc589 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2068,7 +2068,6 @@ __acquires(&pool->lock)
 {
 	struct pool_workqueue *pwq = get_work_pwq(work);
 	struct worker_pool *pool = worker->pool;
-	bool cpu_intensive = pwq->wq->flags & WQ_CPU_INTENSIVE;
 	int work_color;
 	struct worker *collision;
 #ifdef CONFIG_LOCKDEP
@@ -2118,7 +2117,7 @@ __acquires(&pool->lock)
 	 * CPU intensive works don't participate in concurrency
 	 * management.  They're the scheduler's responsibility.
 	 */
-	if (unlikely(cpu_intensive))
+	if (unlikely(pwq->wq->flags & WQ_CPU_INTENSIVE))
 		worker_set_flags(worker, WORKER_CPU_INTENSIVE, true);
 
 	/*
@@ -2161,8 +2160,8 @@ __acquires(&pool->lock)
 
 	spin_lock_irq(&pool->lock);
 
-	/* clear cpu intensive status */
-	if (unlikely(cpu_intensive))
+	/* clear cpu intensive status if it is set */
+	if (unlikely(worker->flags & WORKER_CPU_INTENSIVE))
 		worker_clr_flags(worker, WORKER_CPU_INTENSIVE);
 
 	/* we're done with it, release */
-- 
1.7.7.6


  parent reply	other threads:[~2013-04-14 16:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-14 16:41 [PATCH 0/8] workqueue: advance concurrency management Lai Jiangshan
2013-04-14 16:41 ` [PATCH 1/8] workqueue: remove @cpu from wq_worker_sleeping() Lai Jiangshan
2013-04-14 16:41 ` [PATCH 2/8] workqueue: use create_and_start_worker() in manage_workers() Lai Jiangshan
2013-04-14 16:41 ` Lai Jiangshan [this message]
2013-04-14 16:41 ` [PATCH 4/8] workqueue: quit cm mode when sleeping Lai Jiangshan
2013-04-14 16:41 ` [PATCH 5/8] workqueue: remove disabled wq_worker_waking_up() Lai Jiangshan
2013-04-14 16:41 ` [PATCH 6/8] workqueue: make nr_running non-atomic Lai Jiangshan
2013-04-14 16:41 ` [PATCH 7/8] workqueue: move worker->flags up Lai Jiangshan
2013-04-14 16:41 ` [PATCH 8/8] workqueue: rename ->nr_running to ->nr_cm_workers Lai Jiangshan
2013-04-18 22:10 ` [PATCH 0/8] workqueue: advance concurrency management Lai Jiangshan
2013-04-19 18:11   ` Tejun Heo
2013-04-20 16:02     ` Lai Jiangshan

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=1365957716-7631-4-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®