Re: How to avoid data copies in a driver ?

From: linux-os (Dick Johnson)
Date: Wed May 14 2008 - 17:23:24 EST



On Wed, 14 May 2008, Francis Moreau wrote:

> Hello,
>
> I'd like to optimize my driver, which receives data through a fifo and gives
> them to a user space application. In turns this application moves this data
> into a file.
>
> To avoid several useless copies, I'd like the application to pass to
> the driver
> a file descriptor (?) to the driver and then the driver can directly
> move the
> received data to that file.
>
> Could anybody give me some example of such scheme ?
>
> Thanks,
> --
> Francis
> --

You memory-map the data. Impliment mmap() in your driver.
You can also impliment poll() { select() } so your
application knows when new data are available.

You cannot use a user-mode file-descriptor in the kernel.


Cheers,
Dick Johnson
Penguin : Linux version 2.6.22.1 on an i686 machine (5588.29 BogoMips).
My book : http://www.AbominableFirebug.com/
_


****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@xxxxxxxxxxxx - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.
--
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/