git: d6074f73af5c - main - pipe: use pipe subsystem KVA counter instead of pipe_map size

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 20 Sep 2024 14:03:54 UTC
The branch main has been updated by kib:

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

commit d6074f73af5c813524022cf6ee7dab9c4cbe44be
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-09-20 11:59:19 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-09-20 14:03:45 +0000

    pipe: use pipe subsystem KVA counter instead of pipe_map size
    
    to calculate the superuser-reserved amount of the pipe space
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
---
 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 68b57708d653..ab045c718e75 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -592,9 +592,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) {