From: "Francis Moreau" <francis.moro@gmail.com>
To: "Jeremy Fitzhardinge" <jeremy@goop.org>
Cc: "linux-os (Dick Johnson)" <linux-os@analogic.com>,
linux-kernel@vger.kernel.org
Subject: Re: How to avoid data copies in a driver ?
Date: Fri, 16 May 2008 13:44:47 +0200 [thread overview]
Message-ID: <38b2ab8a0805160444w1a982cffw94ba91b30f5c2aac@mail.gmail.com> (raw)
In-Reply-To: <482D416B.8060501@goop.org>
Hello,
On Fri, May 16, 2008 at 10:10 AM, Jeremy Fitzhardinge <jeremy@goop.org> wrote:
> Francis Moreau wrote:
>>
>> I'm suprised because what I need doens't seem so uncommon, usually
>> devices send or
>> receive data to/from files. So a helper (system call ?) to achieve
>> that other than the basic
>> read/write seems needed, no ?
>>
>
> It's fairly rare to have an application which requires moving data to file
> with absolutely no processing; normally there's at least a bit of
> massaging/parsing/etc.
Well, every cases where a client <-> server exchange files. I wouldn't call
that a rare case...
> If that's really what you want to do, maybe you can
> do it with splice? I haven't looked at it at all, but the intention is that
> you can splice file descriptors together, so you can splice your device fd
> to a file fd and have it all just work...
>
yes but the kernel I'm working on (2.6.16) doens't have splice support.
But relay may sound a good idea, and the version I use has sendfile support.
The drawback of relay: the user application can receive a file from the kernel
but the app can't send a file to the kernel.
But I can be wrong since I haven't look at relay closely yet.
> Alternatively you could read() from your device into a mmaped file. That's
> a single copy from device to file, which is about the best you can do
> without going to heroic lengths.
>
Don't know for now.
I think using sendfile with relay may be a good answer without me becoming
a hero ;)
> Also, it really depends on your application. Is it a high-bandwidth thing
> in which the copy is a huge cost? Or do you want to eliminate the copies
> because it seems like a nice thing to do?
No it has a real cost. The application receives files which are usually larger
than 1Go.
Thanks
--
Francis
next prev parent reply other threads:[~2008-05-16 11:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-14 19:54 Francis Moreau
2008-05-14 20:02 ` Lennart Sorensen
2008-05-15 7:44 ` Francis Moreau
2008-05-15 13:59 ` Lennart Sorensen
2008-05-16 20:17 ` Francis Moreau
2008-05-14 21:23 ` linux-os (Dick Johnson)
2008-05-15 7:40 ` Francis Moreau
2008-05-15 11:50 ` Arnd Hannemann
2008-05-15 12:08 ` Francis Moreau
2008-05-15 13:16 ` linux-os (Dick Johnson)
2008-05-16 8:10 ` Jeremy Fitzhardinge
2008-05-16 11:44 ` Francis Moreau [this message]
2008-05-21 10:41 ` Pavel Machek
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=38b2ab8a0805160444w1a982cffw94ba91b30f5c2aac@mail.gmail.com \
--to=francis.moro@gmail.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-os@analogic.com \
/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
all inboxes | Powered by JetHome®