diff options
author | Mike Larkin <mlarkin@cvs.openbsd.org> | 2011-11-13 22:36:28 +0000 |
---|---|---|
committer | Mike Larkin <mlarkin@cvs.openbsd.org> | 2011-11-13 22:36:28 +0000 |
commit | 7e42c7e78a0445fae79a8c53c5e13301069f2715 (patch) | |
tree | d72519f363daa94050389e4e3b44a0744c8da992 /sys/kern/subr_hibernate.c | |
parent | fc5e7c71f13392cfc1167445c150e9e2c55d3a1b (diff) |
In hibernate resume, free the piglet and other VAs we allocated during
suspend.
ok pirofti@
Diffstat (limited to 'sys/kern/subr_hibernate.c')
-rw-r--r-- | sys/kern/subr_hibernate.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/sys/kern/subr_hibernate.c b/sys/kern/subr_hibernate.c index 60b9e7a5784..dafc5e1fea0 100644 --- a/sys/kern/subr_hibernate.c +++ b/sys/kern/subr_hibernate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_hibernate.c,v 1.19 2011/11/13 18:38:10 mlarkin Exp $ */ +/* $OpenBSD: subr_hibernate.c,v 1.20 2011/11/13 22:36:27 mlarkin Exp $ */ /* * Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl> @@ -44,6 +44,7 @@ vaddr_t hibernate_chunktable_area; /* Hibernate info as read from disk during resume */ union hibernate_info disk_hiber_info; paddr_t global_pig_start; +vaddr_t global_piglet_va; /* * Hib alloc enforced alignment. @@ -1703,6 +1704,8 @@ hibernate_suspend(void) if (get_hibernate_info(&hib_info, 1)) return (1); + global_piglet_va = hib_info.piglet_va; + /* XXX - Won't need to zero everything with RLE */ uvm_pmr_zero_everything(); @@ -1715,6 +1718,23 @@ hibernate_suspend(void) if (hibernate_write_signature(&hib_info)) return (1); - delay(100000); + delay(500000); return (0); } + +/* + * Free items allocated during hibernate + */ +void +hibernate_free(void) +{ + uvm_pmr_free_piglet(global_piglet_va, 3*HIBERNATE_CHUNK_SIZE); + + pmap_kremove(hibernate_copy_page, PAGE_SIZE); + pmap_kremove(hibernate_temp_page, PAGE_SIZE); + pmap_update(pmap_kernel()); + + km_free((void *)hibernate_fchunk_area, 3*PAGE_SIZE, &kv_any, &kp_none); + km_free((void *)hibernate_copy_page, PAGE_SIZE, &kv_any, &kp_none); + km_free((void *)hibernate_temp_page, PAGE_SIZE, &kv_any, &kp_none); +} |