git: 6536b979b856 - stable/14 - pipe: use pipe subsystem KVA counter instead of pipe_map size

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sat, 05 Oct 2024 07:11:17 UTC
The branch stable/14 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=6536b979b856096809d46e92039a7a51e0b646d9

commit 6536b979b856096809d46e92039a7a51e0b646d9
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-09-20 11:59:19 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-10-05 07:08:55 +0000

    pipe: use pipe subsystem KVA counter instead of pipe_map size
    
    (cherry picked from commit d6074f73af5c813524022cf6ee7dab9c4cbe44be)
---
 sys/kern/sys_pipe.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index 2e5eafee9fa6..380bc165cef5 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -593,9 +593,8 @@ retry:
 	}
 
 	vm_map_lock(pipe_map);
-	if (priv_check(curthread, PRIV_PIPEBUF) != 0 &&
-	    (vm_map_max(pipe_map) - vm_map_min(pipe_map)) *
-	    (100 - pipebuf_reserv) / 100 < pipe_map->size + size) {
+	if (priv_check(curthread, PRIV_PIPEBUF) != 0 && maxpipekva / 100 *
+	    (100 - pipebuf_reserv) < amountpipekva + size) {
 		vm_map_unlock(pipe_map);
 		if (cpipe->pipe_buffer.buffer == NULL &&
 		    size > SMALL_PIPE_SIZE) {