diff --git a/src/engine.c b/src/engine.c index c80048689b79552fc658667a4e0079539ee2f07e..8f752f73639ab0e6276b7a875ecc01fb9a6be07b 100644 --- a/src/engine.c +++ b/src/engine.c @@ -1726,23 +1726,19 @@ void engine_count_and_link_tasks(struct engine *e) { struct task *const t = &sched->tasks[ind]; struct cell *const ci = t->ci; struct cell *const cj = t->cj; - + /* Link sort tasks to the next-higher sort task. */ if (t->type == task_type_sort) { struct cell *finger = t->ci->parent; - while (finger != NULL && finger->sorts == NULL) - finger = finger->parent; - if (finger != NULL) - scheduler_addunlock(sched, t, finger->sorts); + while (finger != NULL && finger->sorts == NULL) finger = finger->parent; + if (finger != NULL) scheduler_addunlock(sched, t, finger->sorts); } /* Link drift tasks to the next-higher drift task. */ else if (t->type == task_type_drift) { struct cell *finger = t->ci->parent; - while (finger != NULL && finger->drift == NULL) - finger = finger->parent; - if (finger != NULL) - scheduler_addunlock(sched, t, finger->drift); + while (finger != NULL && finger->drift == NULL) finger = finger->parent; + if (finger != NULL) scheduler_addunlock(sched, t, finger->drift); } /* Link self tasks to cells. */ diff --git a/src/scheduler.c b/src/scheduler.c index 2579cf0041d8687bdeeac36d8f1fe1891510f794..2d788b91932b67b8eadf3b15ad9ec606937807ec 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -175,12 +175,12 @@ static void scheduler_splittask(struct task *t, struct scheduler *s) { /* Depend on local sorts on this cell. */ if (ci->sorts != NULL) scheduler_addunlock(s, ci->sorts, t); - + /* Add a drift task to this cell. */ lock_lock(&ci->lock); if (ci->drift == NULL) - ci->drift = scheduler_addtask(s, task_type_drift, task_subtype_none, 0, - 0, ci, NULL, 0); + ci->drift = scheduler_addtask(s, task_type_drift, task_subtype_none, + 0, 0, ci, NULL, 0); lock_unlock_blind(&ci->lock); /* Otherwise, make tasks explicitly. */ @@ -252,20 +252,19 @@ static void scheduler_splittask(struct task *t, struct scheduler *s) { /* Depend on the sort tasks of both cells. */ if (ci->sorts != NULL) scheduler_addunlock(s, ci->sorts, t); if (cj->sorts != NULL) scheduler_addunlock(s, cj->sorts, t); - + /* Add a drift task to the cells, if needed. */ lock_lock(&ci->lock); if (ci->drift == NULL) - ci->drift = scheduler_addtask(s, task_type_drift, task_subtype_none, 0, - 0, ci, NULL, 0); + ci->drift = scheduler_addtask(s, task_type_drift, task_subtype_none, + 0, 0, ci, NULL, 0); lock_unlock_blind(&ci->lock); lock_lock(&cj->lock); if (cj->drift == NULL) - cj->drift = scheduler_addtask(s, task_type_drift, task_subtype_none, 0, - 0, cj, NULL, 0); + cj->drift = scheduler_addtask(s, task_type_drift, task_subtype_none, + 0, 0, cj, NULL, 0); lock_unlock_blind(&cj->lock); - /* Otherwise, split it. */ } else { @@ -646,8 +645,8 @@ static void scheduler_splittask(struct task *t, struct scheduler *s) { /* Create the drift and sort for ci. */ lock_lock(&ci->lock); if (ci->drift == NULL) - ci->drift = scheduler_addtask(s, task_type_drift, task_subtype_none, 0, - 0, ci, NULL, 0); + ci->drift = scheduler_addtask(s, task_type_drift, task_subtype_none, + 0, 0, ci, NULL, 0); if (ci->sorts == NULL) ci->sorts = scheduler_addtask(s, task_type_sort, task_subtype_none, 1 << sid, 0, ci, NULL, 0); @@ -659,8 +658,8 @@ static void scheduler_splittask(struct task *t, struct scheduler *s) { /* Create the sort for cj. */ lock_lock(&cj->lock); if (cj->drift == NULL) - cj->drift = scheduler_addtask(s, task_type_drift, task_subtype_none, 0, - 0, cj, NULL, 0); + cj->drift = scheduler_addtask(s, task_type_drift, task_subtype_none, + 0, 0, cj, NULL, 0); if (cj->sorts == NULL) cj->sorts = scheduler_addtask(s, task_type_sort, task_subtype_none, 1 << sid, 0, cj, NULL, 0);