git: 9front

Download patch

ref: 2ebb6ad371f312e8d15fd8ce385f558a98eb0868
parent: 2b40407e8c45d3a183bb04748f16f6589c68b0fc
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;
--