aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/async.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-01-23 09:32:30 -0800
committerTejun Heo <tj@kernel.org>2013-01-23 09:32:30 -0800
commit52722794d6a48162fd8906d54618ae60a4abdb21 (patch)
tree9395231ed86edd40880a3438f77d10af2f6d953a /include/linux/async.h
parentasync: use ULLONG_MAX for infinity cookie value (diff)
downloadlinux-dev-52722794d6a48162fd8906d54618ae60a4abdb21.tar.xz
linux-dev-52722794d6a48162fd8906d54618ae60a4abdb21.zip
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>
Diffstat (limited to 'include/linux/async.h')
-rw-r--r--include/linux/async.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/include/linux/async.h b/include/linux/async.h
index 34ff5c610e0e..a2e3f18b2ad6 100644
--- a/include/linux/async.h
+++ b/include/linux/async.h
@@ -19,8 +19,7 @@ typedef u64 async_cookie_t;
typedef void (async_func_ptr) (void *data, async_cookie_t cookie);
struct async_domain {
struct list_head node;
- struct list_head running;
- int count;
+ struct list_head pending;
unsigned registered:1;
};
@@ -29,8 +28,7 @@ struct async_domain {
*/
#define ASYNC_DOMAIN(_name) \
struct async_domain _name = { .node = LIST_HEAD_INIT(_name.node), \
- .running = LIST_HEAD_INIT(_name.running), \
- .count = 0, \
+ .pending = LIST_HEAD_INIT(_name.pending), \
.registered = 1 }
/*
@@ -39,8 +37,7 @@ struct async_domain {
*/
#define ASYNC_DOMAIN_EXCLUSIVE(_name) \
struct async_domain _name = { .node = LIST_HEAD_INIT(_name.node), \
- .running = LIST_HEAD_INIT(_name.running), \
- .count = 0, \
+ .pending = LIST_HEAD_INIT(_name.pending), \
.registered = 0 }
extern async_cookie_t async_schedule(async_func_ptr *ptr, void *data);