All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Simon Kagstrom <simon.kagstrom@netinsight.net>
Cc: Tejun Heo <tj@kernel.org>,
	linux-kernel@vger.kernel.org, laijs@cn.fujitsu.com,
	rusty@rustcorp.com.au, akpm@linux-foundation.org, mingo@elte.hu
Subject: Re: [PATCH v2] core: workqueue: return on workqueue recursion
Date: Thu, 4 Feb 2010 11:52:13 +0100	[thread overview]
Message-ID: <20100204105213.GB21188@redhat.com> (raw)
In-Reply-To: <20100204090216.131fc73f@marrow.netinsight.se>

On 02/04, Simon Kagstrom wrote:
>
> When the workqueue is flushed from workqueue context (recursively), the
> system enters a strange state where things at random (dependent on the
> global workqueue) start misbehaving. For example, for us the console and
> logins locks up while the web server continues running.
>
> The system becomes unstable since the workqueue barrier locks the
> workqueue. This patch instead returns if the workqueue is flushed
> recursively, which keeps the workqueue alive but warns.
>
> Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>

Acked-by: Oleg Nesterov <oleg@redhat.com>

> ---
> ChangeLog:
> 	* Instead of BUG_ON, warn and return on recursive calls as suggested
> 	  by Oleg Nesterov and Tejun Hao
>
>  kernel/workqueue.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index dee4865..49f8fa7 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -482,7 +482,8 @@ static int flush_cpu_workqueue(struct cpu_workqueue_struct *cwq)
>  	int active = 0;
>  	struct wq_barrier barr;
>
> -	WARN_ON(cwq->thread == current);
> +	if (WARN_ON(cwq->thread == current))
> +		return 1;
>
>  	spin_lock_irq(&cwq->lock);
>  	if (!list_empty(&cwq->worklist) || cwq->current_work != NULL) {
> --
> 1.6.0.4
>


  reply	other threads:[~2010-02-04 10:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-03 11:27 [PATCH] core: workqueue: BUG_ON on workqueue recursion Simon Kagstrom
2010-02-03 19:43 ` Oleg Nesterov
2010-02-04  2:12   ` Tejun Heo
2010-02-04  8:02     ` [PATCH v2] core: workqueue: return " Simon Kagstrom
2010-02-04 10:52       ` Oleg Nesterov [this message]
2010-02-12  8:47       ` Tejun Heo
2010-02-04  2:00 ` [PATCH] core: workqueue: BUG_ON " 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=20100204105213.GB21188@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rusty@rustcorp.com.au \
    --cc=simon.kagstrom@netinsight.net \
    --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 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.