linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/13] workqueue: enhance locking and record global worker id for work data
@ 2013-01-31 18:41 Lai Jiangshan
  2013-01-31 18:41 ` [PATCH 01/13] workqueue: remove WORK_CPU_NONE Lai Jiangshan
                   ` (13 more replies)
  0 siblings, 14 replies; 48+ messages in thread
From: Lai Jiangshan @ 2013-01-31 18:41 UTC (permalink / raw)
  To: Tejun Heo, linux-kernel; +Cc: Lai Jiangshan

Better Locking:
---------

We have a much complex way to find out on which pool a given work is queued on,
mainly based on *mb() which is the most dangerous code and bad for readability.
This series change the usage of CWQ bit and makes these code simpler.
	--PATCH 3,4,5

We have get_work_pool(), but it requires the caller do the later check and locking,
we replace it which 3 better internal locking API. 1) More proper API and
2) merge the duplicated code and 3) simplify the caller.
	--PATCH 8,9,10

get_work_pool()/get_work_pool_id() are called everywhere, something they are
overkill(called idr_find() unneeded) and indirectly(caller knows it is onq or not),
we replace them with get_work_cwq()/offq_work_pool_id()/locking APIs.
	--PATCH 3,4,5,6,8,9,10


Safely/one-step searching and worker id:
----------------------------------------

We are planing to add non-std worker_pool, but old get_work_pool() or new
lock_pool_executing_work() was not prepared for this plan, idr_find(pool_id)
is unsafe when we introduce free-able non-std worker_pool. Although we can
fix it by adding rcu to worker_pool. but "recording global worker id for
work data and adding rcu to worker" is another way and more straight forward.
We implement the later one,  Now, lock_pool_executing_work() is ready for this plan.
	--PATCH 12,13

When every time we need to find out the running worker from a work,
we need two searches: search work_pool from work's data, and search worker
from hash. We record global worker id for work data and we only need one search.
	--PATCH 13

cleanup
	--PATCH 1,2,7,11

On top of tj/for-3.9 706026c2141113886f61e1ad2738c9a7723ec69c

Lai Jiangshan (13):
  workqueue: remove WORK_CPU_NONE
  workqueue: fix work_busy()
  workqueue: don't set work cwq until we queued it on pool
  workqueue: clear cwq when cancel the work
  workqueue: change queued detection and remove *mb()s
  workqueue: get pool id from work->data directly if it is offq
  workqueue: get pool from wq/cwq
  workqueue: add lock_pool_executing_work()
  workqueue: add lock_pool_queued_work()
  workqueue: add lock_pool_own_work() and remove get_work_pool()
  workqueue: allow more work_pool id space
  workqueue: add worker's global worker ID
  workqueue: record global worker ID instead of pool ID in work->data
    when off-queue

 include/linux/workqueue.h   |   24 ++--
 kernel/workqueue.c          |  428 +++++++++++++++++++++++--------------------
 kernel/workqueue_internal.h |    1 +
 3 files changed, 242 insertions(+), 211 deletions(-)

-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2013-02-13 22:24 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-31 18:41 [PATCH 00/13] workqueue: enhance locking and record global worker id for work data Lai Jiangshan
2013-01-31 18:41 ` [PATCH 01/13] workqueue: remove WORK_CPU_NONE Lai Jiangshan
2013-02-04 19:49   ` Tejun Heo
2013-02-05 12:03     ` Lai Jiangshan
2013-02-06 22:34   ` [PATCH wq/for-3.9] workqueue: replace WORK_CPU_NONE/LAST with WORK_CPU_END Tejun Heo
2013-01-31 18:41 ` [PATCH 02/13] workqueue: fix work_busy() Lai Jiangshan
2013-02-04 19:54   ` Tejun Heo
2013-02-05 12:06     ` Lai Jiangshan
2013-02-05 18:53       ` Tejun Heo
2013-02-06 11:42         ` Lai Jiangshan
2013-02-06 14:05           ` Tejun Heo
2013-02-06 23:02   ` [PATCH wq/for-3.9] workqueue: make work_busy() test WORK_STRUCT_PENDING first Tejun Heo
2013-01-31 18:41 ` [PATCH 03/13] workqueue: don't set work cwq until we queued it on pool Lai Jiangshan
2013-02-04 21:28   ` Tejun Heo
2013-02-05 15:00     ` Lai Jiangshan
2013-02-05 16:45       ` Tejun Heo
2013-02-06 11:35         ` Lai Jiangshan
2013-02-06 14:18           ` Tejun Heo
2013-02-05 15:06     ` Lai Jiangshan
2013-02-07  0:28   ` [PATCH wq/for-3.9 workqueue]: add delayed_work->wq to simplify reentrancy handling Tejun Heo
2013-01-31 18:41 ` [PATCH 04/13] workqueue: clear cwq when cancel the work Lai Jiangshan
2013-02-07  0:53   ` [PATCH wq/for-3.9] workqueue: make work->data point to pool after try_to_grab_pending() Tejun Heo
2013-01-31 18:41 ` [PATCH 05/13] workqueue: change queued detection and remove *mb()s Lai Jiangshan
2013-02-07  1:52   ` [PATCH wq/for-3.9] workqueue: simplify is-work-item-queued-here test Tejun Heo
2013-02-07  2:03     ` [PATCH wq/for-3.9] workqueue: cosmetic update in try_to_grab_pending() Tejun Heo
2013-01-31 18:41 ` [PATCH 06/13] workqueue: get pool id from work->data directly if it is offq Lai Jiangshan
2013-02-07 20:16   ` [PATCH wq/for-3.9] workqueue: make get_work_pool_id() cheaper Tejun Heo
2013-01-31 18:41 ` [PATCH 07/13] workqueue: get pool from wq/cwq Lai Jiangshan
2013-02-07 21:13   ` [PATCH wq/for-3.9] workqueue: pick cwq instead of pool in __queue_work() Tejun Heo
2013-01-31 18:41 ` [PATCH 08/13] workqueue: add lock_pool_executing_work() Lai Jiangshan
2013-02-04 21:34   ` Tejun Heo
2013-02-05 12:15     ` Lai Jiangshan
2013-02-05 19:09       ` Tejun Heo
2013-01-31 18:41 ` [PATCH 09/13] workqueue: add lock_pool_queued_work() Lai Jiangshan
2013-01-31 18:41 ` [PATCH 10/13] workqueue: add lock_pool_own_work() and remove get_work_pool() Lai Jiangshan
2013-02-04 21:38   ` Tejun Heo
2013-01-31 18:41 ` [PATCH 11/13] workqueue: allow more work_pool id space Lai Jiangshan
2013-01-31 18:41 ` [PATCH 12/13] workqueue: add worker's global worker ID Lai Jiangshan
2013-02-04 21:39   ` Tejun Heo
2013-01-31 18:41 ` [PATCH 13/13] workqueue: record global worker ID instead of pool ID in work->data when off-queue Lai Jiangshan
2013-02-04 21:40   ` Tejun Heo
2013-02-04 22:12   ` Tejun Heo
2013-02-05 15:18     ` Lai Jiangshan
2013-02-07 22:02   ` Tejun Heo
2013-02-13 22:23     ` Tejun Heo
2013-02-04 21:04 ` [PATCH 00/13] workqueue: enhance locking and record global worker id for work data Tejun Heo
2013-02-05 16:19   ` Lai Jiangshan
2013-02-05 16:50     ` Tejun Heo

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).