Re: [PATCH] zerocopy NFS updated

David S. Miller
2002-04-15T04:31:04Z

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);