<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/workqueue.c, branch v2.6.38</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v2.6.38</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.38'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2011-02-16T17:10:19Z</updated>
<entry>
<title>workqueue: make sure MAYDAY_INITIAL_TIMEOUT is at least 2 jiffies long</title>
<updated>2011-02-16T17:10:19Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2011-02-16T17:10:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3233cdbd9fa347a6d6897a94cc6ed0302ae83c4f'/>
<id>urn:sha1:3233cdbd9fa347a6d6897a94cc6ed0302ae83c4f</id>
<content type='text'>
MAYDAY_INITIAL_TIMEOUT is defined as HZ / 100 and depending on
configuration may end up 0 or 1.  Even when it's 1, depending on when
the mayday timer is added in the current jiffy interval, it may expire
way before a jiffy has passed.

Make sure MAYDAY_INITIAL_TIMEOUT is at least two to guarantee that at
least a full jiffy has passed before calling rescuers.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: Ray Jui &lt;rjui@broadcom.com&gt;
Cc: stable@kernel.org
</content>
</entry>
<entry>
<title>workqueue, freezer: unify spelling of 'freeze' + 'able' to 'freezable'</title>
<updated>2011-02-16T16:48:59Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2011-02-16T08:25:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=58a69cb47ec6991bf006a3e5d202e8571b0327a4'/>
<id>urn:sha1:58a69cb47ec6991bf006a3e5d202e8571b0327a4</id>
<content type='text'>
There are two spellings in use for 'freeze' + 'able' - 'freezable' and
'freezeable'.  The former is the more prominent one.  The latter is
mostly used by workqueue and in a few other odd places.  Unify the
spelling to 'freezable'.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Acked-by: "Rafael J. Wysocki" &lt;rjw@sisk.pl&gt;
Acked-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Acked-by: Dmitry Torokhov &lt;dtor@mail.ru&gt;
Cc: David Woodhouse &lt;dwmw2@infradead.org&gt;
Cc: Alex Dubov &lt;oakad@yahoo.com&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Steven Whitehouse &lt;swhiteho@redhat.com&gt;
</content>
</entry>
<entry>
<title>workqueue: wake up a worker when a rescuer is leaving a gcwq</title>
<updated>2011-02-14T13:04:46Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2011-02-14T13:04:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7576958a9d5a4a677ad7dd40901cdbb6c1110c98'/>
<id>urn:sha1:7576958a9d5a4a677ad7dd40901cdbb6c1110c98</id>
<content type='text'>
After executing the matching works, a rescuer leaves the gcwq whether
there are more pending works or not.  This may decrease the
concurrency level to zero and stall execution until a new work item is
queued on the gcwq.

Make rescuer wake up a regular worker when it leaves a gcwq if there
are more works to execute, so that execution isn't stalled.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: Ray Jui &lt;rjui@broadcom.com&gt;
Cc: stable@kernel.org
</content>
</entry>
<entry>
<title>workqueue: note the nested NOT_RUNNING test in worker_clr_flags() isn't a noop</title>
<updated>2011-01-11T15:03:14Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2011-01-11T14:58:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=42c025f3de9042d9c9abd9a6f6205d1a0f4bcadf'/>
<id>urn:sha1:42c025f3de9042d9c9abd9a6f6205d1a0f4bcadf</id>
<content type='text'>
The nested NOT_RUNNING test in worker_clr_flags() is slightly
misleading in that if NOT_RUNNING were a single flag the nested test
would be always %true and thus noop.  Add a comment noting that the
test isn't a noop.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Hillf Danton &lt;dhillf@gmail.com&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>workqueue: relax lockdep annotation on flush_work()</title>
<updated>2011-01-11T14:33:01Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2011-01-09T22:32:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e159489baa717dbae70f9903770a6a4990865887'/>
<id>urn:sha1:e159489baa717dbae70f9903770a6a4990865887</id>
<content type='text'>
Currently, the lockdep annotation in flush_work() requires exclusive
access on the workqueue the target work is queued on and triggers
warning if a work is trying to flush another work on the same
workqueue; however, this is no longer true as workqueues can now
execute multiple works concurrently.

This patch adds lock_map_acquire_read() and make process_one_work()
hold read access to the workqueue while executing a work and
start_flush_work() check for write access if concurrnecy level is one
or the workqueue has a rescuer (as only one execution resource - the
rescuer - is guaranteed to be available under memory pressure), and
read access if higher.

This better represents what's going on and removes spurious lockdep
warnings which are triggered by fake dependency chain created through
flush_work().

* Peter pointed out that flushing another work from a WQ_MEM_RECLAIM
  wq breaks forward progress guarantee under memory pressure.
  Condition check accordingly updated.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-by: "Rafael J. Wysocki" &lt;rjw@sisk.pl&gt;
Tested-by: "Rafael J. Wysocki" &lt;rjw@sisk.pl&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: stable@kernel.org
</content>
</entry>
<entry>
<title>workqueue: allow chained queueing during destruction</title>
<updated>2010-12-20T18:32:04Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2010-12-20T18:32:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c8efcc2589464ac70255bb83e10cad61c7c6d295'/>
<id>urn:sha1:c8efcc2589464ac70255bb83e10cad61c7c6d295</id>
<content type='text'>
Currently, destroy_workqueue() makes the workqueue deny all new
queueing by setting WQ_DYING and flushes the workqueue once before
proceeding with destruction; however, there are cases where work items
queue more related work items.  Currently, such users need to
explicitly flush the workqueue multiple times depending on the
possible depth of such chained queueing.

This patch updates the queueing path such that a work item can queue
further work items on the same workqueue even when WQ_DYING is set.
The flush on destruction is automatically retried until the workqueue
is empty.  This guarantees that the workqueue is empty on destruction
while allowing chained queueing.

The flush retry logic whines if it takes too many retries to drain the
workqueue.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
</content>
</entry>
<entry>
<title>workqueue: It is likely that WORKER_NOT_RUNNING is true</title>
<updated>2010-12-14T14:05:54Z</updated>
<author>
<name>Steven Rostedt</name>
<email>srostedt@redhat.com</email>
</author>
<published>2010-12-04T04:12:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2d64672ed38721b7a3815009d79bfb90a1f34a17'/>
<id>urn:sha1:2d64672ed38721b7a3815009d79bfb90a1f34a17</id>
<content type='text'>
Running the annotate branch profiler on three boxes, including my
main box that runs firefox, evolution, xchat, and is part of the distcc farm,
showed this with the likelys in the workqueue code:

 correct incorrect  %        Function                  File              Line
 ------- ---------  -        --------                  ----              ----
      96   996253  99 wq_worker_sleeping             workqueue.c          703
      96   996247  99 wq_worker_waking_up            workqueue.c          677

The likely()s in this case were assuming that WORKER_NOT_RUNNING will
most likely be false. But this is not the case. The reason is
(and shown by adding trace_printks and testing it) that most of the time
WORKER_PREP is set.

In worker_thread() we have:

	worker_clr_flags(worker, WORKER_PREP);

	[ do work stuff ]

	worker_set_flags(worker, WORKER_PREP, false);

(that 'false' means not to wake up an idle worker)

The wq_worker_sleeping() is called from schedule when a worker thread
is putting itself to sleep. Which happens most of the time outside
of that [ do work stuff ].

The wq_worker_waking_up is called by the wakeup worker code, which
is also callod outside that [ do work stuff ].

Thus, the likely and unlikely used by those two functions are actually
backwards.

Remove the annotation and let gcc figure it out.

Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>workqueue: check the allocation of system_unbound_wq</title>
<updated>2010-11-26T11:06:44Z</updated>
<author>
<name>Hitoshi Mitake</name>
<email>mitake@dcl.info.waseda.ac.jp</email>
</author>
<published>2010-11-26T11:06:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e5cba24e3f018d4beb6acd101a82483c98f91ce7'/>
<id>urn:sha1:e5cba24e3f018d4beb6acd101a82483c98f91ce7</id>
<content type='text'>
I found a trivial bug on initialization of workqueue.
Current init_workqueues doesn't check the result of
allocation of system_unbound_wq, this should be checked
like other queues.

Signed-off-by: Hitoshi Mitake &lt;mitake@dcl.info.waseda.ac.jp&gt;
Cc: Arjan van de Ven &lt;arjan@linux.intel.com&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>workqueues: s/ON_STACK/ONSTACK/</title>
<updated>2010-10-26T23:52:14Z</updated>
<author>
<name>Andrew Morton</name>
<email>akpm@linux-foundation.org</email>
</author>
<published>2010-10-26T21:22:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ca1cab37d91cbe8a8333732540d43cabb54cfa85'/>
<id>urn:sha1:ca1cab37d91cbe8a8333732540d43cabb54cfa85</id>
<content type='text'>
Silly though it is, completions and wait_queue_heads use foo_ONSTACK
(COMPLETION_INITIALIZER_ONSTACK, DECLARE_COMPLETION_ONSTACK,
__WAIT_QUEUE_HEAD_INIT_ONSTACK and DECLARE_WAIT_QUEUE_HEAD_ONSTACK) so I
guess workqueues should do the same thing.

s/INIT_WORK_ON_STACK/INIT_WORK_ONSTACK/
s/INIT_DELAYED_WORK_ON_STACK/INIT_DELAYED_WORK_ONSTACK/

Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>MN10300: Fix the PERCPU() alignment to allow for workqueues</title>
<updated>2010-10-25T23:24:06Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2010-10-25T22:41:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5260562754c0aa4b95eebb1f851eaccce7286365'/>
<id>urn:sha1:5260562754c0aa4b95eebb1f851eaccce7286365</id>
<content type='text'>
In the MN10300 arch, we occasionally see an assertion being tripped in
alloc_cwqs() at the following line:

        /* just in case, make sure it's actually aligned */
  ---&gt;  BUG_ON(!IS_ALIGNED(wq-&gt;cpu_wq.v, align));
        return wq-&gt;cpu_wq.v ? 0 : -ENOMEM;

The values are:

        wa-&gt;cpu_wq.v =&gt; 0x902776e0
        align =&gt; 0x100

and align is calculated by the following:

        const size_t align = max_t(size_t, 1 &lt;&lt; WORK_STRUCT_FLAG_BITS,
                                   __alignof__(unsigned long long));

This is because the pointer in question (wq-&gt;cpu_wq.v) loses some of its
lower bits to control flags, and so the object it points to must be
sufficiently aligned to avoid the need to use those bits for pointing to
things.

Currently, 4 control bits and 4 colour bits are used in normal
circumstances, plus a debugging bit if debugging is set.  This requires
the cpu_workqueue_struct struct to be at least 256 bytes aligned (or 512
bytes aligned with debugging).

PERCPU() alignment on MN13000, however, is only 32 bytes as set in
vmlinux.lds.S.  So we set this to PAGE_SIZE (4096) to match most other
arches and stick a comment in alloc_cwqs() for anyone else who triggers
the assertion.

Reported-by: Akira Takeuchi &lt;takeuchi.akr@jp.panasonic.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Mark Salter &lt;msalter@redhat.com&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
