tracts of unused memory, and the empty-space RLE scanner (uvm_page_rle)
would rescan for empty space needlessly wasting excessive cpu time
16G machine, 100sec -> 9sec
40G machine, 325sec -> 28sec
with kettenis mlarkin
-/* $OpenBSD: subr_hibernate.c,v 1.127 2021/07/08 23:19:51 mlarkin Exp $ */
+/* $OpenBSD: subr_hibernate.c,v 1.128 2021/08/30 09:45:29 deraadt Exp $ */
/*
* Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
* therefore pg->fpgsz cannot be used.
*/
for (pg_end = pg; pg_end <= vmp->lastpg &&
- (pg_end->pg_flags & PQ_FREE) == PQ_FREE; pg_end++)
+ (pg_end->pg_flags & PQ_FREE) == PQ_FREE &&
+ (pg_end - pg) < HIBERNATE_CHUNK_SIZE/PAGE_SIZE; pg_end++)
;
- return min((pg_end - pg), HIBERNATE_CHUNK_SIZE/PAGE_SIZE);
+ return pg_end - pg;
}
/*