summaryrefslogtreecommitdiffstats
path: root/sys/rpc/svc.h
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>2015-10-30 19:26:55 +0000
committerwollman <wollman@FreeBSD.org>2015-10-30 19:26:55 +0000
commit17773fe32f343338047ad3073d99c3f85d2216e0 (patch)
treec58f5402c052e70d748dfab37f580993f4e5c8a2 /sys/rpc/svc.h
parent70c328a1bb25b20c3bbe50598ce0d42cee505255 (diff)
downloadFreeBSD-src-17773fe32f343338047ad3073d99c3f85d2216e0.zip
FreeBSD-src-17773fe32f343338047ad3073d99c3f85d2216e0.tar.gz
Long-overdue MFC of r280930:
Fix overflow bugs in and remove obsolete limit from kernel RPC implementation. The kernel RPC code, which is responsible for the low-level scheduling of incoming NFS requests, contains a throttling mechanism that prevents too much kernel memory from being tied up by NFS requests that are being serviced. When the throttle is engaged, the RPC layer stops servicing incoming NFS sockets, resulting ultimately in backpressure on the clients (if they're using TCP). However, this is a very heavy-handed mechanism as it prevents all clients from making any requests, regardless of how heavy or light they are. (Thus, when engaged, the throttle often prevents clients from even mounting the filesystem.) The throttle mechanism applies specifically to requests that have been received by the RPC layer (from a TCP or UDP socket) and are queued waiting to be serviced by one of the nfsd threads; it does not limit the amount of backlog in the socket buffers. The original implementation limited the total bytes of queued requests to the minimum of a quarter of (nmbclusters * MCLBYTES) and 45 MiB. The former limit seems reasonable, since requests queued in the socket buffers and replies being constructed to the requests in progress will all require some amount of network memory, but the 45 MiB limit is plainly ridiculous for modern memory sizes: when running 256 service threads on a busy server, 45 MiB would result in just a single maximum-sized NFS3PROC_WRITE queued per thread before throttling. Removing this limit exposed integer-overflow bugs in the original computation, and related bugs in the routines that actually account for the amount of traffic enqueued for service threads. The old implementation also attempted to reduce accounting overhead by batching updates until each queue is fully drained, but this is prone to livelock, resulting in repeated accumulate-throttle-drain cycles on a busy server. Various data types are changed to long or unsigned long; explicit 64-bit types are not used due to the unavailability of 64-bit atomics on many 32-bit platforms, but those platforms also cannot support nmbclusters large enough to cause overflow. This code (in a 10.1 kernel) is presently running on production NFS servers at CSAIL. Summary of this revision: * Removes 45 MiB limit on requests queued for nfsd service threads * Fixes integer-overflow and signedness bugs * Avoids unnecessary throttling by not deferring accounting for completed requests Differential Revision: https://reviews.freebsd.org/D2165 Reviewed by: rmacklem, mav Relnotes: yes Sponsored by: MIT Computer Science & Artificial Intelligence Laboratory
Diffstat (limited to 'sys/rpc/svc.h')
-rw-r--r--sys/rpc/svc.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/rpc/svc.h b/sys/rpc/svc.h
index 1c7bbce..80285ec 100644
--- a/sys/rpc/svc.h
+++ b/sys/rpc/svc.h
@@ -371,10 +371,10 @@ typedef struct __rpc_svcpool {
* amount of memory used by RPC requests which are queued
* waiting for execution.
*/
- unsigned int sp_space_low;
- unsigned int sp_space_high;
- unsigned int sp_space_used;
- unsigned int sp_space_used_highest;
+ unsigned long sp_space_low;
+ unsigned long sp_space_high;
+ unsigned long sp_space_used;
+ unsigned long sp_space_used_highest;
bool_t sp_space_throttled;
int sp_space_throttle_count;
OpenPOWER on IntegriCloud