mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-27 17:11:46 +00:00
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>
This commit is contained in:
parent
c68eee14ec
commit
52722794d6
2 changed files with 17 additions and 55 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue