From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Jonathan Corbet <corbet@lwn.net>
Cc: Arjan van de Ven <arjan@infradead.org>,
linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org
Subject: Re: [PATCH 1/7] async: Asynchronous function calls to speed up kernel boot
Date: Wed, 14 Jan 2009 12:34:54 +0100 [thread overview]
Message-ID: <20090114123454.6af6ff4b@gondolin> (raw)
In-Reply-To: <20090113134859.08005199@bike.lwn.net>
On Tue, 13 Jan 2009 13:48:59 -0700,
Jonathan Corbet <corbet@lwn.net> wrote:
> [A somewhat belated question...]
>
> As I read the patch, I find the async_entry structure:
>
> > +struct async_entry {
> > + struct list_head list;
> > + async_cookie_t cookie;
> > + async_func_ptr *func;
> > + void *data;
> > + struct list_head *running;
> > +};
>
> The "running" field is, presumably, meant to hold a pointer to the
> "running" queue to be used when this function is actually run. But, then,
> I see:
>
> > +async_cookie_t async_schedule(async_func_ptr *ptr, void *data)
> > +{
> > + return __async_schedule(ptr, data, &async_pending);
> > +}
> > +EXPORT_SYMBOL_GPL(async_schedule);
>
> It seems to me that you wanted &async_running there, no?
>
> However, it doesn't matter in the current form of the patch:
>
> > +/*
> > + * 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);
> > + spin_unlock_irqrestore(&async_lock, flags);
>
> Given the way things are designed, don't you want to add the entry to
> entry->running, rather than unconditionally to async_running? If not, I
> don't see how calls to async_synchronize_cookie_special() can work right.
>
> Of course, I'm probably just confused...enlighten me?
No, you're not confused, the code is :)
async_schedule() should pass in async_running as the running
list, and run_one_entry() should put the entry to be run on
the provided running list instead of always on the generic one.
Reported-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
kernel/async.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- linux-2.6.orig/kernel/async.c
+++ linux-2.6/kernel/async.c
@@ -133,7 +133,7 @@ static void run_one_entry(void)
/* 2) move it to the running queue */
list_del(&entry->list);
- list_add_tail(&entry->list, &async_running);
+ list_add_tail(&entry->list, entry->running);
spin_unlock_irqrestore(&async_lock, flags);
/* 3) run it (and print duration)*/
@@ -207,7 +207,7 @@ static async_cookie_t __async_schedule(a
async_cookie_t async_schedule(async_func_ptr *ptr, void *data)
{
- return __async_schedule(ptr, data, &async_pending);
+ return __async_schedule(ptr, data, &async_running);
}
EXPORT_SYMBOL_GPL(async_schedule);
next prev parent reply other threads:[~2009-01-14 11:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-07 23:11 [PATCH 0/7] V3 of the async function call patches Arjan van de Ven
2009-01-07 23:12 ` [PATCH 1/7] async: Asynchronous function calls to speed up kernel boot Arjan van de Ven
2009-01-08 0:31 ` Arnaldo Carvalho de Melo
2009-01-08 1:17 ` Arjan van de Ven
2009-01-13 20:48 ` Jonathan Corbet
2009-01-14 11:34 ` Cornelia Huck [this message]
2009-02-14 0:22 ` Andrew Morton
2009-02-14 4:59 ` Arjan van de Ven
2009-02-14 7:29 ` Andrew Morton
2009-02-15 19:16 ` Arjan van de Ven
2009-02-15 22:19 ` Arjan van de Ven
2009-02-16 10:31 ` Cornelia Huck
2009-01-07 23:12 ` [PATCH 2/7] fastboot: make scsi probes asynchronous Arjan van de Ven
2009-01-07 23:13 ` [PATCH 3/7] fastboot: make the libata port scan asynchronous Arjan van de Ven
2009-01-07 23:13 ` [PATCH 4/7] fastboot: Make libata initialization even more async Arjan van de Ven
2009-01-07 23:14 ` [PATCH 5/7] async: make the final inode deletion an asynchronous event Arjan van de Ven
2009-01-07 23:14 ` [PATCH 6/7] bootchart: improve output based on Dave Jones' feedback Arjan van de Ven
2009-01-07 23:15 ` [PATCH 7/7] async: don't do the initcall stuff post boot Arjan van de Ven
2009-01-08 0:17 ` [PATCH 0/7] V3 of the async function call patches Linus Torvalds
2009-01-08 1:21 ` Arjan van de Ven
2009-01-15 8:10 ` Pavel Machek
2009-01-09 20:21 ` Ryan Hope
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090114123454.6af6ff4b@gondolin \
--to=cornelia.huck@de.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=arjan@infradead.org \
--cc=corbet@lwn.net \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox