git: b21104487324 - main - sendfile: ensure that the low water mark is at least a page size
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 30 Apr 2025 17:06:04 UTC
The branch main has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=b2110448732434841fc30bb0af0d28902a6621b3
commit b2110448732434841fc30bb0af0d28902a6621b3
Author: Jonathan T. Looney <jtl@FreeBSD.org>
AuthorDate: 2025-04-30 17:03:04 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-04-30 17:05:47 +0000
sendfile: ensure that the low water mark is at least a page size
, when possible, to cut down on the possibility of short I/Os.
This change has been at Netflix for several years already.
---
sys/kern/kern_sendfile.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c
index 05a820fe5ac1..d409f41824ad 100644
--- a/sys/kern/kern_sendfile.c
+++ b/sys/kern/kern_sendfile.c
@@ -779,6 +779,9 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio,
SOCKBUF_LOCK(&so->so_snd);
if (so->so_snd.sb_lowat < so->so_snd.sb_hiwat / 2)
so->so_snd.sb_lowat = so->so_snd.sb_hiwat / 2;
+ if (so->so_snd.sb_lowat < PAGE_SIZE &&
+ so->so_snd.sb_hiwat >= PAGE_SIZE)
+ so->so_snd.sb_lowat = PAGE_SIZE;
retry_space:
if (so->so_snd.sb_state & SBS_CANTSENDMORE) {
error = EPIPE;