From efa9c5cc8939f43583c25717e6aaae8c98cf17e1 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Wed, 23 Nov 2011 07:11:32 +0000 Subject: clamp uvm_page_rle() to 255 pages at a time ok mlarkin --- sys/kern/subr_hibernate.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sys/kern/subr_hibernate.c') diff --git a/sys/kern/subr_hibernate.c b/sys/kern/subr_hibernate.c index d1d7c41fe28..cb4d540d290 100644 --- a/sys/kern/subr_hibernate.c +++ b/sys/kern/subr_hibernate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_hibernate.c,v 1.29 2011/11/22 07:59:06 mlarkin Exp $ */ +/* $OpenBSD: subr_hibernate.c,v 1.30 2011/11/23 07:11:31 deraadt Exp $ */ /* * Copyright (c) 2011 Ariane van der Steldt @@ -565,7 +565,7 @@ uvm_pmr_free_piglet(vaddr_t va, vsize_t sz) * Physmem RLE compression support. * * Given a physical page address, it will return the number of pages - * starting at the address, that are free. + * starting at the address, that are free. Clamps to a max of 255 pages. * Returns 0 if the page at addr is not free. */ psize_t @@ -590,8 +590,9 @@ 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++); - return pg_end - pg; + (pg_end->pg_flags & PQ_FREE) == PQ_FREE; pg_end++) + ; + return max(pg_end - pg, 255); } /* -- cgit v1.2.3