summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2011-11-23 07:11:31 +0000
committerderaadt <deraadt@openbsd.org>2011-11-23 07:11:31 +0000
commit51c66804700ecba205f8155bfd728109192722d1 (patch)
tree64530718aeae71642391fe7997a84bf3a19c99ea /sys
parentproperly account for the MP tramp page in the ranges (diff)
downloadwireguard-openbsd-51c66804700ecba205f8155bfd728109192722d1.tar.xz
wireguard-openbsd-51c66804700ecba205f8155bfd728109192722d1.zip
clamp uvm_page_rle() to 255 pages at a time
ok mlarkin
Diffstat (limited to 'sys')
-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);
}
/*