On Tue, 2005-08-30 at 12:09 +0300, Gilad Ben-Yossef wrote:
> Gilboa Davara wrote:
> > Hello all,
> >
> > Couple of weeks ago I started a thread called "File I/O within kernel
> > threads?" which ended with a call "for numbers". (Read: Is I/O within
> > kernel performance increase justifies the development overhead?)
> > Last week I took my user-land simulator (that takes a file, reads it,
> > and creates and sends two raw multiplexed streams out of it); and
> > converted it into a kernel module.
> > The performance increase was nothing short of staggering: From ~1100Mbps
> > to ~1700Mbps. (Which is fairly close to the theoretical limit of 2 GbE
> > NICs.)
> > While both versions could be further optimized, it's clear that the
> > kernel version has an very impressive performance lead.
> > Considering these numbers, I opt to choose a Kernel mode solution.
> >
>
> Not so fast, cowboy :-)
>
> How did your user space simulator sent the files?
>
> If you've just did a read/write pair you should be using Linux's
> sendfile() system call (assuming no proccessing is required on the
> content of the file) and I expect you'll find you don't need a kernel
> moduel after all.
Without quoting the original thread, the storage contains multiplexed
data, and thus, unless using sendfile is pretty useless.
Same goes for the final product, sending using sendfile will require
something in the lines of:
1: read packet header.
modify header to reflect current state.
send header over wire.
send packet data using sendfile.
start over.
I rather do:
read huge buffer from disk.
1:
parse huge block.
modify header on block.
send full packet.
start over till buffer depleted.
>
>
> > My question is simple:
> > While it's fairly easy to do normal buffered I/O from kernel mode (using
> > flip_open/close and ->read/->write methods) for the life of me I cannot
> > seem to find how to do O_DIRECT I/O from kernel mode.
> > More-ever, as I need a single huge file on a dedicated computer, I don't
> > really need the FS/VFA/pagecache over-head, AFAIC I rather do raw I/O
> > directly on-to the target block device.
> > Can anyone point me into the right direction?
> >
> > I'm currently trying to drill down the kernel source but it's a daunting
> > task, to say the least.
> >
> > Again, I fully understand the implications of my request; I understand
> > that I'm bending Linux sideways, etc.
> >
>
> I don't think you bend Linux sideways. I think you're trying to bend the
> situation to be such that you'll get a good excuse to show managment to
> let you write kernel code ;-)
>
> Nothing wrong about that of course, at least not in my book, but while
> you can fool management, don't try to fool yourself.
Umm...
I say tomayto, you say tomahto...
>
>
> Anyway, if you don't know how to use O_DIRECT from inside the kernel,
> why don't you take a look at the part in teh kernel that implments
> O_DIRECT from user space and do the same thing?
Already on it; However, this code is fairly complex. It involves the
file management, vmm, etc. It's very easy to get lost in there... :/
If I can save the next 3 days of ctags drilling (or at least get some
pointers as for where to look) I'll be one happy man.
>
> Gilad
>
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]