SUNRPC: Use MSG_SENDPAGE_NOTLAST when calling sendpage()
Subsystems (3)
PATCH 1/1 SUNRPC: Use MSG_SENDPAGE_NOTLAST when calling sendpage()
If we're sending more pages via kernel_sendpage(), then set MSG_SENDPAGE_NOTLAST.
--- net/sunrpc/svcsock.c | 2 +- net/sunrpc/xprtsock.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)
net/sunrpc/svcsock.c +1 -1
@@ -181,7 +181,7 @@ int svc_send_common(struct socket *sock, struct xdr_buf *xdr,struct page **ppage = xdr->pages;size_t base = xdr->page_base;unsigned int pglen = xdr->page_len; -unsigned int flags =MSG_MORE ; +unsigned int flags =MSG_MORE |MSG_SENDPAGE_NOTLAST ;int slen;int len =0 ;
net/sunrpc/xprtsock.c +3 -1
@@ -360,8 +360,10 @@ static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned iint flags =XS_SENDMSG_FLAGS ; remainder -= len; -if (remainder !=0 || more) +if (more) flags |=MSG_MORE ; +if (remainder !=0 ) + flags |=MSG_SENDPAGE_NOTLAST |MSG_MORE ; err =do_sendpage (sock, *ppage, base, len, flags);if (remainder ==0 || err != len)break ;
Signature · 1 line
2.4.3
Quoted 2 lines · Trond Myklebust
If we're sending more pages via
kernel_sendpage(), then setMSG_SENDPAGE_NOTLAST.
Given that we've survived without this a while, I assume this is a hint that may provide better performance in some cases (have you seen that?) and that it doesn't have to be 100% correct?
In which case, looks fine, will queue up for 4.4....
--b.
Quoted 38 lines
Signed-off-by Trond Myklebust <[email protected]>--- net/sunrpc/svcsock.c | 2 +- net/sunrpc/xprtsock.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)net/sunrpc/svcsock.c +1
-1@@ -181,7 +181,7 @@ int svc_send_common(struct socket *sock, struct xdr_buf *xdr,struct page **ppage = xdr->pages;size_t base = xdr->page_base;unsigned int pglen = xdr->page_len; -unsigned int flags =MSG_MORE ; +unsigned int flags =MSG_MORE |MSG_SENDPAGE_NOTLAST ;int slen;int len =0 ;net/sunrpc/xprtsock.c +3
-1@@ -360,8 +360,10 @@ static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned iint flags =XS_SENDMSG_FLAGS ; remainder -= len; -if (remainder !=0 || more) +if (more) flags |=MSG_MORE ; +if (remainder !=0 ) + flags |=MSG_SENDPAGE_NOTLAST |MSG_MORE ; err =do_sendpage (sock, *ppage, base, len, flags);if (remainder ==0 || err != len)break ;Signature · 1 line
2.4.3
Quoted 7 lines · Bruce Fields
Quoted 2 lines · Trond Myklebust
If we're sending more pages via
kernel_sendpage(), then setMSG_SENDPAGE_NOTLAST.Given that we've survived without this a while, I assume this is a hint that may provide better performance in some cases (have you seen that?) and that it doesn't have to be 100% correct?
See the original motivation in:
commit 2f5338442425 ("tcp: allow splice() to build full TSO packets")
and the later bugfix (which actually introduces MSG_SENDPAGE_NOTLAST):
commit 35f9c09fe9c7 ("tcp: tcp_sendpages() should call tcp_push() once")
Quoted 1 line
In which case, looks fine, will queue up for 4.4....
Sure. It's a minor performance enhancement, so there is no immediate rush.
Quoted 13 lines · Trond Myklebust
Quoted 7 lines · Bruce Fields
Quoted 2 lines · Trond Myklebust
If we're sending more pages via
kernel_sendpage(), then setMSG_SENDPAGE_NOTLAST.Given that we've survived without this a while, I assume this is a hint that may provide better performance in some cases (have you seen that?) and that it doesn't have to be 100% correct?
See the original motivation in:
commit
2f5338442425("tcp: allowsplice()to build full TSO packets")
Quoted 7 lines
and the later bugfix (which actually introduces
MSG_SENDPAGE_NOTLAST):commit
35f9c09fe9c7("tcp:tcp_sendpages()should calltcp_push()once")Quoted 1 line
In which case, looks fine, will queue up for 4.4....
Sure. It's a minor performance enhancement, so there is no immediate rush.
Actually, please let me split this into 2 subpatches; one for the sunrpc server code and one for the client. It would make it easier for me if I could keep the client performance stuff in one branch.
Quoted 19 lines · Trond Myklebust
Quoted 17 lines · Trond Myklebust
Quoted 7 lines · Bruce Fields
Quoted 2 lines · Trond Myklebust
If we're sending more pages via
kernel_sendpage(), then setMSG_SENDPAGE_NOTLAST.Given that we've survived without this a while, I assume this is a hint that may provide better performance in some cases (have you seen that?) and that it doesn't have to be 100% correct?
See the original motivation in:
commit
2f5338442425("tcp: allowsplice()to build full TSO packets")and the later bugfix (which actually introduces
MSG_SENDPAGE_NOTLAST):commit
35f9c09fe9c7("tcp:tcp_sendpages()should calltcp_push()once")
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
In which case, looks fine, will queue up for 4.4....
Sure. It's a minor performance enhancement, so there is no immediate rush.
Actually, please let me split this into 2 subpatches; one for the sunrpc server code and one for the client. It would make it easier for me if I could keep the client performance stuff in one branch.
Sure, makes sense.--b.
PATCH v2 1/2 SUNRPC: Use MSG_SENDPAGE_NOTLAST in xs_send_pagedata()
If we're sending more than one page via kernel_sendpage(), then set MSG_SENDPAGE_NOTLAST between the pages so that we don't send suboptimal frames (see commit 2f5338442425 and commit 35f9c09fe9c7).
--- net/sunrpc/xprtsock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/sunrpc/xprtsock.c +3 -1
@@ -360,8 +360,10 @@ static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned iint flags =XS_SENDMSG_FLAGS ; remainder -= len; -if (remainder !=0 || more) +if (more) flags |=MSG_MORE ; +if (remainder !=0 ) + flags |=MSG_SENDPAGE_NOTLAST |MSG_MORE ; err =do_sendpage (sock, *ppage, base, len, flags);if (remainder ==0 || err != len)break ;
Signature · 1 line
2.4.3
PATCH v2 2/2 SUNRPC: Use MSG_SENDPAGE_NOTLAST in svc_send_common()
Allow the NFS server to send large amounts of data in page form without forcing early transmit by do_tcp_sendpages(). See commit 2f5338442425 and commit 35f9c09fe9c7.
--- net/sunrpc/svcsock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/svcsock.c +1 -1
@@ -181,7 +181,7 @@ int svc_send_common(struct socket *sock, struct xdr_buf *xdr,struct page **ppage = xdr->pages;size_t base = xdr->page_base;unsigned int pglen = xdr->page_len; -unsigned int flags =MSG_MORE ; +unsigned int flags =MSG_MORE |MSG_SENDPAGE_NOTLAST ;int slen;int len =0 ;
Signature · 1 line
2.4.3