From 56bc0efbd80da2ff595e44601f8d41473418bf4a Mon Sep 17 00:00:00 2001 From: deraadt Date: Mon, 30 Aug 2021 09:45:29 +0000 Subject: [PATCH] increase hibernate writeout speed a little. modern machines have vast 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 --- sys/kern/subr_hibernate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/kern/subr_hibernate.c b/sys/kern/subr_hibernate.c index a72e7faa76f..e84b27a5764 100644 --- a/sys/kern/subr_hibernate.c +++ b/sys/kern/subr_hibernate.c @@ -1,4 +1,4 @@ -/* $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 @@ -541,9 +541,10 @@ uvm_page_rle(paddr_t addr) * 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; } /* -- 2.20.1