diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2013-11-04 19:42:48 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2013-11-04 19:42:48 +0000 |
commit | 0956088e4e881151d43cec11f3c8b08e6e934de7 (patch) | |
tree | dc8ebda7aedce90e9ddcfdb012808af2b6c22d53 /sys/uvm | |
parent | ae546e01bcbd5d4b46bb28c02df9f4a067e01b54 (diff) |
If compiled for hibernate, reserve the last page of the primary swap
space (in case we need to place a hibernate signature there)
ok miod
Diffstat (limited to 'sys/uvm')
-rw-r--r-- | sys/uvm/uvm_swap.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/uvm/uvm_swap.c b/sys/uvm/uvm_swap.c index a27a2b0d337..75362c5aaca 100644 --- a/sys/uvm/uvm_swap.c +++ b/sys/uvm/uvm_swap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_swap.c,v 1.118 2013/11/04 19:41:17 deraadt Exp $ */ +/* $OpenBSD: uvm_swap.c,v 1.119 2013/11/04 19:42:47 deraadt Exp $ */ /* $NetBSD: uvm_swap.c,v 1.40 2000/11/17 11:39:39 mrg Exp $ */ /* @@ -983,7 +983,20 @@ swap_on(struct proc *p, struct swapdev *sdp) if (addr) { if (extent_alloc_region(sdp->swd_ex, 0, addr, EX_WAITOK)) panic("disklabel reserve"); + /* XXX: is extent synchronized with swd_npginuse? */ } +#ifdef HIBERNATE + /* + * Lock down the last region of primary disk swap, in case + * hibernate needs to place a signature there. + */ + if (dev == swdevt[0].sw_dev && vp->v_type == VBLK && size > 3 ) { + if (extent_alloc_region(sdp->swd_ex, + npages - 1 - 1, 1, EX_WAITOK)) + panic("hibernate reserve"); + /* XXX: is extent synchronized with swd_npginuse? */ + } +#endif /* * add a ref to vp to reflect usage as a swap device. |