From: michi1@michaelblizek.twilightparadox.com (michi1 at michaelblizek.twilightparadox.com)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Generic I/O
Date: Tue, 15 Nov 2011 20:12:21 +0100 [thread overview]
Message-ID: <20111115191220.GB2219@grml> (raw)
In-Reply-To: <4EC2B21A.4070005@gnukai.com>
Hi!
On 11:40 Tue 15 Nov , Kai Meyer wrote:
> On 11/15/2011 11:13 AM, michi1 at michaelblizek.twilightparadox.com wrote:
...
> > You might want to take a look at wait queues (the kernel equivalent to pthread
> > "condidions"). Basically you instead of calling msleep(), you call
> > wait_event(). In the function which decrements numbios, you check whether it
> > is 0 and if so call wake_up().
...
> That sounds very promising. When I read up on wait_event here:
> lxr.linux.no/#linux+v2.6.32/include/linux/wait.h#L191
>
> It sounds like it's basically doing the same thing. I would call it like so:
>
> wait_event(wq, atomic_read(numbios) == 0);
Yes, you dol something like this.
> To make sure I understand, this seems very much like what I'm doing,
> except I'm being woken up every time a bio finishes instead of being
> woken up once every millisecond. That is, I'm assuming I would use the
> same work queue for all my bios.
You are *not* woken up every time you a bio finishes. You are woken up every
time you call wake_up(). You could do something like:
if (atomic_dec_return(numbios) == 0)
wake_up(wp);
> During my testing, when I do a lot of disk I/O, I may potentially have
> hundreds of threads waiting on anywhere between 1 and 32 bios. Help me
> understand the sort of impact you think I might see between having
> hundreds waiting for a millisecond, and having hundreds get woken up
> each time a bio completes. It seems like it would be very helpful in low
> I/O scenarios, especially when there are fast disks involved. I'm
> concerned that during heavy I/O loads, I'll be doing a lot of
> atomic_reads, and I have the impression that atomic_read isn't the
> cheapest operation.
The wakeups might some some overhead. However, I would worry more about
scheduling overhead on smp systems than atomic_read performance.
-Michi
--
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com
next prev parent reply other threads:[~2011-11-15 19:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-14 19:15 Generic I/O Kai Meyer
2011-11-15 18:13 ` michi1 at michaelblizek.twilightparadox.com
2011-11-15 18:40 ` Kai Meyer
2011-11-15 19:12 ` michi1 at michaelblizek.twilightparadox.com [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-10-31 16:24 generic I/O Kai Meyer
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=20111115191220.GB2219@grml \
--to=michi1@michaelblizek.twilightparadox.com \
--cc=kernelnewbies@lists.kernelnewbies.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.