Re: [PATCH 1/7] async: Asynchronous function calls to speed upkernel boot

From: Arnaldo Carvalho de Melo
Date: Wed Jan 07 2009 - 19:32:23 EST


Em Wed, Jan 07, 2009 at 03:12:26PM -0800, Arjan van de Ven escreveu:

<SNIP>

> +/*
> + * MUST be called with the lock held!
> + */
> +static async_cookie_t __lowest_in_progress(struct list_head *running)
> +{
> + struct async_entry *entry;
> + if (!list_empty(&async_pending)) {
> + entry = list_first_entry(&async_pending,
> + struct async_entry, list);

Small nitpick:

- > + return entry->cookie;
> + } else if (!list_empty(running)) {
> + entry = list_first_entry(running,
> + struct async_entry, list);
- > + return entry->cookie;
> + } else {
> + /* nothing in progress... next_cookie is "infinity" */
> + return next_cookie;
> + }

+ return entry->cookie;

> +/*
> + * pick the first pending entry and run it
> + */
> +static void run_one_entry(void)
> +{
> + unsigned long flags;
> + struct async_entry *entry;
> + ktime_t calltime, delta, rettime;
> +
> + /* 1) pick one task from the pending queue */
> +
> + spin_lock_irqsave(&async_lock, flags);
> + if (list_empty(&async_pending))
> + goto out;
> + entry = list_first_entry(&async_pending, struct async_entry, list);
> +
> + /* 2) move it to the running queue */
> + list_del(&entry->list);
> + list_add_tail(&entry->list, &async_running);

We have list_move_tail()

> + spin_unlock_irqrestore(&async_lock, flags);
> +
> + /* 3) run it (and print duration)*/
> + if (initcall_debug) {
> + printk("calling %lli_%pF @ %i\n", entry->cookie, entry->func, task_pid_nr(current));
> + calltime = ktime_get();

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/