lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 16 May 2008 13:44:47 +0200
From:	"Francis Moreau" <francis.moro@...il.com>
To:	"Jeremy Fitzhardinge" <jeremy@...p.org>
Cc:	"linux-os (Dick Johnson)" <linux-os@...logic.com>,
	linux-kernel@...r.kernel.org
Subject: Re: How to avoid data copies in a driver ?

Hello,

On Fri, May 16, 2008 at 10:10 AM, Jeremy Fitzhardinge <jeremy@...p.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ