async: keep pending tasks on async_domain and remove async_pending
authorTejun Heo <tj@kernel.org>
Wed, 23 Jan 2013 17:32:30 +0000 (09:32 -0800)
committerTejun Heo <tj@kernel.org>
Wed, 23 Jan 2013 17:32:30 +0000 (09:32 -0800)
commit52722794d6a48162fd8906d54618ae60a4abdb21
tree9395231ed86edd40880a3438f77d10af2f6d953a
parentc68eee14ec2da345e86f2778c8570759309a4a2e
async: keep pending tasks on async_domain and remove async_pending

Async kept single global pending list and per-domain running lists.
When an async item is queued, it's put on the global pending list.
The item is moved to the per-domain running list when its execution
starts.

At this point, this design complicates execution and synchronization
without bringing any benefit.  The list only matters for
synchronization which doesn't care whether a given async item is
pending or executing.  Also, global synchronization is done by
iterating through all active registered async_domains, so the global
async_pending list doesn't help anything either.

Rename async_domain->running to async_domain->pending and put async
items directly there and remove when execution completes.  This
simplifies lowest_in_progress() a lot - the first item on the pending
list is the one with the lowest cookie, and async_run_entry_fn()
doesn't have to mess with moving the item from pending to running.

After the change, whether a domain is empty or not can be trivially
determined by looking at async_domain->pending.  Remove
async_domain->count and use list_empty() on pending instead.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Dan Williams <djbw@fb.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/async.h
kernel/async.c