Skip to content

Commit 10a68cd

Browse files
J. Bruce Fieldsgregkh
authored andcommitted
nfsd: fix performance-limiting session calculation
commit c54f24e upstream. We're unintentionally limiting the number of slots per nfsv4.1 session to 10. Often more than 10 simultaneous RPCs are needed for the best performance. This calculation was meant to prevent any one client from using up more than a third of the limit we set for total memory use across all clients and sessions. Instead, it's limiting the client to a third of the maximum for a single session. Fix this. Reported-by: Chris Tracy <ctracy@engr.scu.edu> Cc: stable@vger.kernel.org Fixes: de766e5 "nfsd: give out fewer session slots as limit approaches" Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2c648ca commit 10a68cd

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎fs/nfsd/nfs4state.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,16 +1514,16 @@ static u32 nfsd4_get_drc_mem(struct nfsd4_channel_attrs *ca)
15141514
{
15151515
u32 slotsize = slot_bytes(ca);
15161516
u32 num = ca->maxreqs;
1517-
int avail;
1517+
unsigned long avail, total_avail;
15181518

15191519
spin_lock(&nfsd_drc_lock);
1520-
avail = min((unsigned long)NFSD_MAX_MEM_PER_SESSION,
1521-
nfsd_drc_max_mem - nfsd_drc_mem_used);
1520+
total_avail = nfsd_drc_max_mem - nfsd_drc_mem_used;
1521+
avail = min((unsigned long)NFSD_MAX_MEM_PER_SESSION, total_avail);
15221522
/*
15231523
* Never use more than a third of the remaining memory,
15241524
* unless it's the only way to give this client a slot:
15251525
*/
1526-
avail = clamp_t(int, avail, slotsize, avail/3);
1526+
avail = clamp_t(int, avail, slotsize, total_avail/3);
15271527
num = min_t(int, num, avail / slotsize);
15281528
nfsd_drc_mem_used += num * slotsize;
15291529
spin_unlock(&nfsd_drc_lock);

0 commit comments

Comments
 (0)