Re: [PATCH] zerocopy NFS updated

David S. Miller (davem@redhat.com)
Sun, 14 Apr 2002 21:23:08 -0700 (PDT)


From: Hirokazu Takahashi <taka@valinux.co.jp>
Date: Mon, 15 Apr 2002 10:30:13 +0900 (JST)

I'd like to implenent sendpage of UDP stack which NFS uses heavily.
It may improve the performance of NFS over UDP dramastically.

I wonder if there were "SENDPAGES" interface instead of sendpage
between socket layer and inet layer, we could send some pages
atomically with low overhead.
And it could make implementing RPC over UDP easier
to send multiple pages as one UDP pakcet easily.

How do you think about this approach?

Sendpages mechanism will not be implemented.

You must implement UDP sendfile() one page at a time, by building up
an SKB with multiple calls similar to TCP with TCP_CORK socket option
set.

For datagram sockets, define temporary SKB hung off of struct sock.
Define UDP_CORK socket option which begins the "queue data only"
state.

All sendmsg()/sendfile() calls append to temporary SKB, first
sendmsg()/sendfile() call to UDP will create this sock->skb. First
call may be sendmsg() but subsequent calls for that SKB must be
sendfile() calls. If this pattern of calls is broken, SKB is sent.

Call to set UDP_CORK socket option to zero actually sends the SKB
being built.

The normal usage will be:

setsockopt(fd, UDP_CORK, 1);
sendmsg(fd, sunrpc_headers, sizeof(sunrpc_headers));
sendfile(fd, ...);
setsockopt(fd, UDP_CORK, 0);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/