Re: How to avoid data copies in a driver ?
- From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
- Date: Fri, 16 May 2008 09:10:19 +0100
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. 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...
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.
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?
J
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: How to avoid data copies in a driver ?
- From: Francis Moreau
- Re: How to avoid data copies in a driver ?
- References:
- How to avoid data copies in a driver ?
- From: Francis Moreau
- Re: How to avoid data copies in a driver ?
- From: linux-os (*** Johnson)
- Re: How to avoid data copies in a driver ?
- From: Francis Moreau
- How to avoid data copies in a driver ?
- Prev by Date: Re: [PATCH] x86: Get irq for hpet timer
- Next by Date: Re: [PATCH] crypto: make michael_block a function
- Previous by thread: Re: How to avoid data copies in a driver ?
- Next by thread: Re: How to avoid data copies in a driver ?
- Index(es):