diff options
author | 2013-11-04 19:42:47 +0000 | |
---|---|---|
committer | 2013-11-04 19:42:47 +0000 | |
commit | 28a64e11d86f10e0e92dcf7a81b606034985b15f (patch) | |
tree | 0690a6bb8159d02a5c3eddb2bc9ac77fb1071136 | |
parent | improve a panic message (diff) | |
download | wireguard-openbsd-28a64e11d86f10e0e92dcf7a81b606034985b15f.tar.xz wireguard-openbsd-28a64e11d86f10e0e92dcf7a81b606034985b15f.zip |
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
-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. |