Patch "NFSD: Reduce svc_rqst::rq_pages churn during READDIR operations" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    NFSD: Reduce svc_rqst::rq_pages churn during READDIR operations

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     nfsd-reduce-svc_rqst-rq_pages-churn-during-readdir-o.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 96a6c44015e8d61dbfe298981eeaf4a4b15c91fe
Author: Chuck Lever <chuck.lever@xxxxxxxxxx>
Date:   Fri Jan 15 09:28:44 2021 -0500

    NFSD: Reduce svc_rqst::rq_pages churn during READDIR operations
    
    [ Upstream commit 76ed0dd96eeb2771b21bf5dcbd88326ef89ee0ed ]
    
    During NFSv2 and NFSv3 READDIR/PLUS operations, NFSD advances
    rq_next_page to the full size of the client-requested buffer, then
    releases all those pages at the end of the request. The next request
    to use that nfsd thread has to refill the pages.
    
    NFSD does this even when the dirlist in the reply is small. With
    NFSv3 clients that send READDIR operations with large buffer sizes,
    that can be 256 put_page/alloc_page pairs per READDIR request, even
    though those pages often remain unused.
    
    We can save some work by not releasing dirlist buffer pages that
    were not used to form the READDIR Reply. I've left the NFSv2 code
    alone since there are never more than three pages involved in an
    NFSv2 READDIR Reply.
    
    Eventually we should nail down why these pages need to be released
    at all in order to avoid allocating and releasing pages
    unnecessarily.
    
    Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 781bb2b115e74..be1ed33e424e0 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -498,6 +498,9 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp)
 	memcpy(resp->verf, argp->verf, 8);
 	nfs3svc_encode_cookie3(resp, offset);
 
+	/* Recycle only pages that were part of the reply */
+	rqstp->rq_next_page = resp->xdr.page_ptr + 1;
+
 	return rpc_success;
 }
 
@@ -538,6 +541,9 @@ nfsd3_proc_readdirplus(struct svc_rqst *rqstp)
 	memcpy(resp->verf, argp->verf, 8);
 	nfs3svc_encode_cookie3(resp, offset);
 
+	/* Recycle only pages that were part of the reply */
+	rqstp->rq_next_page = resp->xdr.page_ptr + 1;
+
 out:
 	return rpc_success;
 }




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux