[Samba] Samba write performance in kernel
Jeremy Allison
jra at samba.org
Mon Sep 15 16:15:19 GMT 2008
On Mon, Sep 15, 2008 at 02:44:32PM +0800, Lin Mac wrote:
>
> I think my question is not precise. And I'm not really familiar with linux block and virtual file system subsystems, so please correct me if I'm wrong.
Neither am I :-).
> Reading from samba can achieve zero copy with help of sendfile and scather/gather support of NIC driver.
>
> Writing to samba by going to user space and back again would cause 2 memory copy (copy_to_user, copy_from_user).
>
> Writing to samba with splice could avoid going to user space, so there is no memory copy (copy_to_user, copy_from_user). But buffers received from network driver (around 1.5kB each) are sent to file system subsystem and below. Will it be cached and gathered to become a continuous buffer (which cause 1 memory copy), or does virtual file system subsystem and below could support scatter/gather, so there will be no memory copy at all (zero copy) ?
This is a kernel implementation detail. Remember Samba
runs on many other kernels, not just Linux. Linux has
splice, *BSD has receivefile, Solaris probably has
something different.
The point is that Samba calls the kernel function at
the right point to *allow* zero-copy writes - it's up
to the specific kernel to ensure that happens (this
is a long-winded way of saying I'm not a kernel engineer,
sorry :-).
Jeremy.
More information about the samba
mailing list