Guillaume Dargaud <(E-Mail Removed)> wrote:
> I have an application on an embedded device that needs to save large
> buffers as fast as possible. We use a 1Gbps network chip but the
> speed is abysmal (85Mbps max). I just profiled the system and the
> results are clear: the system spends most of its time in
> __copy_tofrom_user(), in other words copying my buffers to the
> network driver.
Are you quite sure the copy is to the network driver? Can the profile
you are taking be coerced into telling you which routines happen to be
calling __copy_tofrom_user()?
> The buffers are saved with fwrite to an NFS mounted drive, without C
> bufferisation (setvbuf).
I would have expected the copies to be from user to kernel on the
write call I'm guessing is underneath the fwrite. That is, into
filecache. From there, I would expect the NFS client code to package
things up to hand-off to the stack - without a further copy I would
think. But I am far from familiar with the Linux NFS client code.
BTW, if there is no buffering of the stream, is there really any
advantage to fwrite() over a plain old write?
> Is there a way to tell the driver to NOT buffer the data ? I'd
> rather wait for the call to return.
Unless there is some sort of NIC chip addressing limitation, or the
chip being driven by the driver is really simple (cannot do
scatter/gather for example), I do not believe there is a "copy to the
network driver."
NFS (or TCP if NFS is not using UDP) must retain a reference to the
data in case it must be retransmitted. So, there must be buffering of
some sort. The question is not whether the data will be buffered, but
whether the data can be sent without being copied.
If your system is 100% CPU bound, waiting or not waiting for the call
to return isn't going to change much.
rick jones
--
It is not a question of half full or empty - the glass has a leak.
The real question is "Can it be patched?"
these opinions are mine, all mine; HP might not want them anyway...

feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...