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.


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.


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?

Gilad


--
Gilad Ben-Yossef <[EMAIL PROTECTED]>
Codefidence. A name you can trust(tm)
Web: http://codefidence.com  | SIP: [EMAIL PROTECTED]
IL: +972.9.8650475 ext. 201  | Fax:            +972.9.8850643
US: +1.360.2275194 ext. 201  | Cel:           +972.52.8260388

"I am Jack's Overwritten Stack Pointer"
        -- Hackers Club, the movie

=================================================================
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]

Reply via email to