shithub: front

Download patch

ref: 4383318eabb50094a0aa325cf4efeea844eea051
parent: 4c583d2f6d739b044385a429eca85e7a2dd8333c
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jul 27 13:34:44 EDT 2025

devsegment: speed up fixedseg()

If a page has non-nil Page.image, it is almost
certanly not free. So reset the search.

Note, this is not a bug. Even if we omit the
Page.image check, we still ensured that the
pages are on the freelist before comitting.

--- a/sys/src/9/port/devsegment.c
+++ b/sys/src/9/port/devsegment.c
@@ -481,7 +481,8 @@
 	l = palloc.pages;
 	color = getpgcolor(va);
 	for(n = palloc.user; n >= len; n--, l++){
-		if(l->ref != 0 || i != 0 && (l[-1].pa+BY2PG) != l->pa || i == 0 && l->color != color){
+		if(l->ref != 0 || l->image != nil
+		|| i != 0 ? (l[-1].pa+BY2PG) != l->pa : l->color != color){
 		Retry:
 			i = 0;
 			continue;
--