From: Tejun Heo <tj@kernel.org>
To: Fengguang Wu <fengguang.wu@intel.com>
Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
joshhunt00@gmail.com, axboe@kernel.dk, rni@google.com,
vgoyal@redhat.com, vwadekar@nvidia.com,
herbert@gondor.hengli.com.au, davem@davemloft.net,
linux-crypto@vger.kernel.org, swhiteho@redhat.com, bpm@sgi.com,
elder@kernel.org, xfs@oss.sgi.com, marcel@holtmann.org,
gustavo@padovan.org, johan.hedberg@gmail.com,
linux-bluetooth@vger.kernel.org, martin.petersen@oracle.com,
Tony Luck <tony.luck@intel.com>
Subject: Re: [PATCH 6/6] workqueue: reimplement WQ_HIGHPRI using a separate worker_pool
Date: Thu, 12 Jul 2012 14:45:14 -0700 [thread overview]
Message-ID: <20120712214514.GD20167@google.com> (raw)
In-Reply-To: <20120712170519.GA20167@google.com>
Hello, again.
On Thu, Jul 12, 2012 at 10:05:19AM -0700, Tejun Heo wrote:
> On Thu, Jul 12, 2012 at 09:06:48PM +0800, Fengguang Wu wrote:
> > [ 0.207977] WARNING: at /c/kernel-tests/mm/kernel/workqueue.c:1217 worker_enter_idle+0x2b8/0x32b()
> > [ 0.207977] Modules linked in:
> > [ 0.207977] Pid: 1, comm: swapper/0 Not tainted 3.5.0-rc6-08414-g9645fff #15
> > [ 0.207977] Call Trace:
> > [ 0.207977] [<ffffffff81087189>] ? worker_enter_idle+0x2b8/0x32b
> > [ 0.207977] [<ffffffff810559d9>] warn_slowpath_common+0xae/0xdb
> > [ 0.207977] [<ffffffff81055a2e>] warn_slowpath_null+0x28/0x31
> > [ 0.207977] [<ffffffff81087189>] worker_enter_idle+0x2b8/0x32b
> > [ 0.207977] [<ffffffff81087222>] start_worker+0x26/0x42
> > [ 0.207977] [<ffffffff81c8b261>] init_workqueues+0x2d2/0x59a
> > [ 0.207977] [<ffffffff81c8af8f>] ? usermodehelper_init+0x8a/0x8a
> > [ 0.207977] [<ffffffff81000284>] do_one_initcall+0xce/0x272
> > [ 0.207977] [<ffffffff81c6f650>] kernel_init+0x12e/0x3c1
> > [ 0.207977] [<ffffffff814b9b74>] kernel_thread_helper+0x4/0x10
> > [ 0.207977] [<ffffffff814b80b0>] ? retint_restore_args+0x13/0x13
> > [ 0.207977] [<ffffffff81c6f522>] ? start_kernel+0x737/0x737
> > [ 0.207977] [<ffffffff814b9b70>] ? gs_change+0x13/0x13
>
> Yeah, I forgot to flip the WARN_ON_ONCE() condition so that it checks
> nr_running before looking at pool->nr_running. The warning is
> spurious. Will post fix soon.
I was wrong and am now dazed and confused. That's from
init_workqueues() where only cpu0 is running. How the hell did
nr_running manage to become non-zero at that point? Can you please
apply the following patch and report the boot log? Thank you.
---
kernel/workqueue.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -699,8 +699,10 @@ void wq_worker_waking_up(struct task_str
{
struct worker *worker = kthread_data(task);
- if (!(worker->flags & WORKER_NOT_RUNNING))
+ if (!(worker->flags & WORKER_NOT_RUNNING)) {
+ WARN_ON_ONCE(cpu != worker->pool->gcwq->cpu);
atomic_inc(get_pool_nr_running(worker->pool));
+ }
}
/**
@@ -730,6 +732,7 @@ struct task_struct *wq_worker_sleeping(s
/* this can only happen on the local cpu */
BUG_ON(cpu != raw_smp_processor_id());
+ WARN_ON_ONCE(cpu != worker->pool->gcwq->cpu);
/*
* The counterpart of the following dec_and_test, implied mb,
@@ -3855,6 +3858,10 @@ static int __init init_workqueues(void)
for (i = 0; i < BUSY_WORKER_HASH_SIZE; i++)
INIT_HLIST_HEAD(&gcwq->busy_hash[i]);
+ if (cpu != WORK_CPU_UNBOUND)
+ printk("XXX cpu=%d gcwq=%p base=%p\n", cpu, gcwq,
+ per_cpu_ptr(&pool_nr_running, cpu));
+
for_each_worker_pool(pool, gcwq) {
pool->gcwq = gcwq;
INIT_LIST_HEAD(&pool->worklist);
@@ -3868,6 +3875,10 @@ static int __init init_workqueues(void)
(unsigned long)pool);
ida_init(&pool->worker_ida);
+
+ printk("XXX cpu=%d nr_running=%d @ %p\n", gcwq->cpu,
+ atomic_read(get_pool_nr_running(pool)),
+ get_pool_nr_running(pool));
}
gcwq->trustee_state = TRUSTEE_DONE;
next prev parent reply other threads:[~2012-07-12 21:45 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-09 18:41 [PATCHSET] workqueue: reimplement high priority using a separate worker pool Tejun Heo
2012-07-09 18:41 ` [PATCH 1/6] workqueue: don't use WQ_HIGHPRI for unbound workqueues Tejun Heo
2012-07-09 18:41 ` [PATCH 2/6] workqueue: factor out worker_pool from global_cwq Tejun Heo
2012-07-10 4:48 ` Namhyung Kim
2012-07-12 17:07 ` Tejun Heo
2012-07-12 21:49 ` [PATCH UPDATED " Tejun Heo
2012-07-09 18:41 ` [PATCH 3/6] workqueue: use @pool instead of @gcwq or @cpu where applicable Tejun Heo
2012-07-10 23:30 ` Tony Luck
2012-07-12 17:06 ` Tejun Heo
2012-07-09 18:41 ` [PATCH 4/6] workqueue: separate out worker_pool flags Tejun Heo
2012-07-09 18:41 ` [PATCH 5/6] workqueue: introduce NR_WORKER_POOLS and for_each_worker_pool() Tejun Heo
2012-07-14 3:55 ` Tejun Heo
2012-07-14 4:27 ` Linus Torvalds
2012-07-14 4:44 ` Tejun Heo
2012-07-14 5:00 ` Linus Torvalds
2012-07-14 5:07 ` Tejun Heo
2012-07-16 19:31 ` Peter Seebach
2012-07-14 5:21 ` [PATCH UPDATED " Tejun Heo
2012-07-09 18:41 ` [PATCH 6/6] workqueue: reimplement WQ_HIGHPRI using a separate worker_pool Tejun Heo
2012-07-12 13:06 ` Fengguang Wu
2012-07-12 17:05 ` Tejun Heo
2012-07-12 21:45 ` Tejun Heo [this message]
2012-07-12 22:16 ` Tony Luck
2012-07-12 22:32 ` Tejun Heo
2012-07-12 23:24 ` Tony Luck
2012-07-12 23:36 ` Tejun Heo
2012-07-12 23:46 ` Tony Luck
2012-07-13 17:51 ` Tony Luck
2012-07-13 2:08 ` Fengguang Wu
2012-07-14 3:41 ` Tejun Heo
2012-07-14 3:56 ` [PATCH UPDATED " Tejun Heo
2012-07-14 8:18 ` Fengguang Wu
2012-07-14 5:24 ` [PATCH UPDATED v3 " 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=20120712214514.GD20167@google.com \
--to=tj@kernel.org \
--cc=axboe@kernel.dk \
--cc=bpm@sgi.com \
--cc=davem@davemloft.net \
--cc=elder@kernel.org \
--cc=fengguang.wu@intel.com \
--cc=gustavo@padovan.org \
--cc=herbert@gondor.hengli.com.au \
--cc=johan.hedberg@gmail.com \
--cc=joshhunt00@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=martin.petersen@oracle.com \
--cc=rni@google.com \
--cc=swhiteho@redhat.com \
--cc=tony.luck@intel.com \
--cc=torvalds@linux-foundation.org \
--cc=vgoyal@redhat.com \
--cc=vwadekar@nvidia.com \
--cc=xfs@oss.sgi.com \
/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