summaryrefslogtreecommitdiff
path: root/sys/kern/subr_hibernate.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2011-11-23 07:11:32 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2011-11-23 07:11:32 +0000
commitefa9c5cc8939f43583c25717e6aaae8c98cf17e1 (patch)
tree8ae1aa206ddb90db3fdb8cd54e2c5bfc96a1780e /sys/kern/subr_hibernate.c
parentde3e0444eda9d3bb11eb4d3b900b0bd7485956c5 (diff)
clamp uvm_page_rle() to 255 pages at a time
ok mlarkin
Diffstat (limited to 'sys/kern/subr_hibernate.c')
-rw-r--r--sys/kern/subr_hibernate.c9
1 files changed, 5 insertions, 4 deletions
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 <ariane@stack.nl>
@@ -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);
}
/*