Skip to content

Commit 6aa09a5

Browse files
committed
async: Split async_schedule_node_domain()
In preparation for subsequent changes, split async_schedule_node_domain() in two pieces so as to allow the bottom part of it to be called from a somewhat different code path. No functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Tested-by: Youngmin Nam <youngmin.nam@samsung.com> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent dadce3f commit 6aa09a5

File tree

1 file changed

+34
-22
lines changed

1 file changed

+34
-22
lines changed

kernel/async.c

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,39 @@ static void async_run_entry_fn(struct work_struct *work)
145145
wake_up(&async_done);
146146
}
147147

148+
static async_cookie_t __async_schedule_node_domain(async_func_t func,
149+
void *data, int node,
150+
struct async_domain *domain,
151+
struct async_entry *entry)
152+
{
153+
async_cookie_t newcookie;
154+
unsigned long flags;
155+
156+
INIT_LIST_HEAD(&entry->domain_list);
157+
INIT_LIST_HEAD(&entry->global_list);
158+
INIT_WORK(&entry->work, async_run_entry_fn);
159+
entry->func = func;
160+
entry->data = data;
161+
entry->domain = domain;
162+
163+
spin_lock_irqsave(&async_lock, flags);
164+
165+
/* allocate cookie and queue */
166+
newcookie = entry->cookie = next_cookie++;
167+
168+
list_add_tail(&entry->domain_list, &domain->pending);
169+
if (domain->registered)
170+
list_add_tail(&entry->global_list, &async_global_pending);
171+
172+
atomic_inc(&entry_count);
173+
spin_unlock_irqrestore(&async_lock, flags);
174+
175+
/* schedule for execution */
176+
queue_work_node(node, system_unbound_wq, &entry->work);
177+
178+
return newcookie;
179+
}
180+
148181
/**
149182
* async_schedule_node_domain - NUMA specific version of async_schedule_domain
150183
* @func: function to execute asynchronously
@@ -186,29 +219,8 @@ async_cookie_t async_schedule_node_domain(async_func_t func, void *data,
186219
func(data, newcookie);
187220
return newcookie;
188221
}
189-
INIT_LIST_HEAD(&entry->domain_list);
190-
INIT_LIST_HEAD(&entry->global_list);
191-
INIT_WORK(&entry->work, async_run_entry_fn);
192-
entry->func = func;
193-
entry->data = data;
194-
entry->domain = domain;
195-
196-
spin_lock_irqsave(&async_lock, flags);
197222

198-
/* allocate cookie and queue */
199-
newcookie = entry->cookie = next_cookie++;
200-
201-
list_add_tail(&entry->domain_list, &domain->pending);
202-
if (domain->registered)
203-
list_add_tail(&entry->global_list, &async_global_pending);
204-
205-
atomic_inc(&entry_count);
206-
spin_unlock_irqrestore(&async_lock, flags);
207-
208-
/* schedule for execution */
209-
queue_work_node(node, system_unbound_wq, &entry->work);
210-
211-
return newcookie;
223+
return __async_schedule_node_domain(func, data, node, domain, entry);
212224
}
213225
EXPORT_SYMBOL_GPL(async_schedule_node_domain);
214226

0 commit comments

Comments
 (0)