All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 06/12] workqueue: destroy_worker() can only destory idle worker not just created worker
Date: Wed, 26 Sep 2012 11:35:36 -0700	[thread overview]
Message-ID: <20120926183536.GG12544@google.com> (raw)
In-Reply-To: <1348680043-5077-7-git-send-email-laijs@cn.fujitsu.com>

On Thu, Sep 27, 2012 at 01:20:37AM +0800, Lai Jiangshan wrote:
> After we reimpletment hotplug code, we will not destroy just newly
> created worker, all created worker will enter idle soon.
> And destroy_worker() is not used to destroy just newly created worker,
> it always destory idle worker, so we need to fix destroy_worker()
> and update the comments.
> 
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> ---
>  kernel/workqueue.c |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 6c339bf..fe3b1d3 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -1756,8 +1756,7 @@ static struct worker *alloc_worker(void)
>   * @pool: pool the new worker will belong to
>   *
>   * Create a new worker which is bound to @pool.  The returned worker
> - * can be started by calling start_worker() or destroyed using
> - * destroy_worker().
> + * can be started by calling start_worker();
>   *
>   * CONTEXT:
>   * Might sleep.  Does GFP_KERNEL allocations.
> @@ -1847,7 +1846,7 @@ static void start_worker(struct worker *worker)
>  }
>  
>  /**
> - * destroy_worker - destroy a workqueue worker
> + * destroy_worker - destroy a idle workqueue worker
>   * @worker: worker to be destroyed
>   *
>   * Destroy @worker and adjust @gcwq stats accordingly.
> @@ -1864,11 +1863,12 @@ static void destroy_worker(struct worker *worker)
>  	/* sanity check frenzy */
>  	BUG_ON(worker->current_work);
>  	BUG_ON(!list_empty(&worker->scheduled));
> +	BUG_ON(!(worker->flags & WORKER_STARTED));
> +	BUG_ON(!(worker->flags & WORKER_IDLE));
> +	BUG_ON(list_empty(&worker->entry));

Let's go for WARN_ON() at least for the new ones.  Or let's convert
all BUG()s to WARN_ON[_ONCE]() beforehand.

Thanks.

-- 
tejun

  reply	other threads:[~2012-09-26 18:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-26 17:20 [PATCH 00/12] workqueue: simple cleanups Lai Jiangshan
2012-09-26 17:20 ` [PATCH 01/12] workqueue: add WORKER_RESCUER Lai Jiangshan
2012-09-26 18:07   ` Tejun Heo
2012-09-28 10:11     ` Lai Jiangshan
2012-09-26 17:20 ` [PATCH 02/12] workqueue: disallow set_cpus_allowed_ptr() from work item Lai Jiangshan
2012-09-26 18:12   ` Tejun Heo
2012-09-26 17:20 ` [PATCH 03/12] workqueue: remove WORKER_PREP from rescuer Lai Jiangshan
2012-09-26 18:24   ` Tejun Heo
2012-09-28 10:04     ` Lai Jiangshan
2012-09-30  7:39       ` Tejun Heo
2012-09-26 17:20 ` [PATCH 04/12] workqueue: simplify is_chained_work() Lai Jiangshan
2012-09-26 18:28   ` Tejun Heo
2012-09-28  9:52     ` Lai Jiangshan
2012-09-30  7:32       ` Tejun Heo
2012-09-26 17:20 ` [PATCH 05/12] workqueue: don't wake up other workers in rescuer Lai Jiangshan
2012-09-26 18:34   ` Tejun Heo
2012-09-28 10:18     ` Lai Jiangshan
2012-09-26 17:20 ` [PATCH 06/12] workqueue: destroy_worker() can only destory idle worker not just created worker Lai Jiangshan
2012-09-26 18:35   ` Tejun Heo [this message]
2012-09-26 17:20 ` [PATCH 07/12] workqueue: remove WORKER_STARTED Lai Jiangshan
2012-09-26 18:36   ` Tejun Heo
2012-09-28  9:52     ` Lai Jiangshan
2012-09-26 17:20 ` [PATCH 08/12] workqueue: fix comments of insert_work() Lai Jiangshan
2012-09-26 17:20 ` [PATCH 09/12] workqueue: declare system_highpri_wq Lai Jiangshan
2012-09-26 17:20 ` [PATCH 10/12] cpu-hotplug.txt: fix comments of work_on_cpu() Lai Jiangshan
2012-09-26 17:20 ` [RFC PATCH 11/12] workqueue: add WQ_CPU_INTENSIVE to system_long_wq Lai Jiangshan
2012-09-26 18:38   ` Tejun Heo
2012-09-28  8:06     ` Lai Jiangshan
2012-09-30  7:22       ` Tejun Heo
2012-09-26 17:20 ` [PATCH 12/12] workqueue: avoid work_on_cpu() to interfere system_wq 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=20120926183536.GG12544@google.com \
    --to=tj@kernel.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.