Module Name:    src
Committed By:   riastradh
Date:           Thu Aug 15 11:33:21 UTC 2024

Modified Files:
        src/sys/uvm: uvm_map.c

Log Message:
uvm_map(9): Apply the same orig_hint clamp again to the same entry.

Previous change dealt with case like length=0x1000 and:

[0x7defb000,0x7defc000)         entry above orig_hint (entry->next)
0x77895000                      orig_hint
[0x77894000,0x77895000)         entry below orig_hint (entry)

by changing

        entry->next->start - length

to

        MIN(orig_hint, entry->next->start - length)

in order to enforce monotonicity of search.

In this case, if the tree search for a gap has failed, we retry with
a list search with exactly the same orig_hint and entry -- nothing
has changed them (only hint and tmp).  So apply the same clamping.

PR kern/51254: uvm assertion "!topdown || hint <= orig_hint" failed


To generate a diff of this commit:
cvs rdiff -u -r1.424 -r1.425 src/sys/uvm/uvm_map.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.424 src/sys/uvm/uvm_map.c:1.425
--- src/sys/uvm/uvm_map.c:1.424	Wed Aug 14 22:24:09 2024
+++ src/sys/uvm/uvm_map.c	Thu Aug 15 11:33:21 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_map.c,v 1.424 2024/08/14 22:24:09 rin Exp $	*/
+/*	$NetBSD: uvm_map.c,v 1.425 2024/08/15 11:33:21 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.424 2024/08/14 22:24:09 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.425 2024/08/15 11:33:21 riastradh Exp $");
 
 #include "opt_ddb.h"
 #include "opt_pax.h"
@@ -2256,7 +2256,8 @@ nextgap:
 	INVARIANTS();
 	for (;;) {
 		/* Update hint for current gap. */
-		hint = topdown ? entry->next->start - length : entry->end;
+		hint = topdown ? MIN(orig_hint, entry->next->start - length)
+		    : entry->end;
 		INVARIANTS();
 
 		/* See if it fits. */

Reply via email to