linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] workqueue: rescuer_thread() processes all pwqs before exit
Date: Thu, 17 Apr 2014 12:27:20 -0400	[thread overview]
Message-ID: <20140417162720.GQ15326@htj.dyndns.org> (raw)
In-Reply-To: <CACvQF53DOj0+sn5EQKLA+mCBdtuceO29gBmH2HCqCOXBmRMWAQ@mail.gmail.com>

On Fri, Apr 18, 2014 at 12:21:51AM +0800, Lai Jiangshan wrote:
> > Hmmm?  Isn't this the same race condition that you tried to remove by
> > relocating the test?  It doesn't matter what destroy_workqueue() does,
> > the rescuer may get preempted inbetween and anything can happen
> > inbetween including someone maydaying and initiation of
> > destroy_workqueue().  Your patch doesn't change the situation at all.
> > It can still return with non-empty mayday list.
> 
> You are right. We need a additional atomic check.

I don't think increasing the number of checks will do anything.  We
just need to keep the test where it is now and exit after doing the
loop.  ie.

	set TASK_INTRRUPTIBLE
	test should_stop and cache the result

	spin_lock_irq();

	while () {
		process the list
	}

	spin_unlock_irq();

	if (was should_stop asserted?)
		exit;

	schedule();

Should do, no?

-- 
tejun

  reply	other threads:[~2014-04-17 16:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27 16:20 [PATCH] workqueue: fix possible race condition when rescuer VS pwq-release Lai Jiangshan
2014-03-28 12:07 ` [PATCH V2] " Lai Jiangshan
2014-03-31 14:40   ` Lai Jiangshan
2014-03-31 20:06     ` Tejun Heo
2014-04-14  7:02       ` Lai Jiangshan
2014-04-15 16:47   ` Tejun Heo
2014-04-16  1:25     ` Lai Jiangshan
2014-04-16 15:23       ` Tejun Heo
2014-04-16 16:21         ` Lai Jiangshan
2014-04-16 16:50           ` Tejun Heo
2014-04-16 22:35             ` Lai Jiangshan
2014-04-16 23:34             ` [PATCH 1/2] workqueue: rescuer_thread() processes all pwqs before exit Lai Jiangshan
2014-04-16 23:34               ` [PATCH 2/2] workqueue: fix possible race condition when rescuer VS pwq-release Lai Jiangshan
2014-04-17 15:27               ` [PATCH 1/2] workqueue: rescuer_thread() processes all pwqs before exit Tejun Heo
2014-04-17 16:04                 ` Lai Jiangshan
2014-04-17 16:08                   ` Tejun Heo
2014-04-17 16:21                     ` Lai Jiangshan
2014-04-17 16:27                       ` Tejun Heo [this message]
2014-04-18 13:25                         ` [PATCH 1/2 V4] " Lai Jiangshan
2014-04-18 13:25                           ` [PATCH 2/2 V4] workqueue: fix possible race condition when rescuer VS pwq-release Lai Jiangshan
2014-04-18 15:06                             ` [PATCH 2/2] workqueue: fix a possible race condition between rescuer and pwq-release Tejun Heo
2014-04-18 16:24                               ` Lai Jiangshan
2014-04-18 16:35                                 ` Tejun Heo
2014-04-18 15:06                           ` [PATCH 1/2] workqueue: make rescuer_thread() empty wq->maydays list before exiting 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=20140417162720.GQ15326@htj.dyndns.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).