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 | |
parent | fc5e7c71f13392cfc1167445c150e9e2c55d3a1b (diff) |
In hibernate resume, free the piglet and other VAs we allocated during
suspend.
ok pirofti@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/subr_hibernate.c | 24 | ||||
-rw-r--r-- | sys/sys/hibernate.h | 3 |
2 files changed, 24 insertions, 3 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); +} diff --git a/sys/sys/hibernate.h b/sys/sys/hibernate.h index 449a36e20bc..dd7b00bf0b0 100644 --- a/sys/sys/hibernate.h +++ b/sys/sys/hibernate.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hibernate.h,v 1.14 2011/09/22 22:12:43 deraadt Exp $ */ +/* $OpenBSD: hibernate.h,v 1.15 2011/11/13 22:36:27 mlarkin Exp $ */ /* * Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl> @@ -125,6 +125,7 @@ int hibernate_read_image(union hibernate_info *); int hibernate_read_chunks(union hibernate_info *, paddr_t, paddr_t, size_t); void hibernate_unpack_image(union hibernate_info *); void hibernate_populate_resume_pt(union hibernate_info *, paddr_t, paddr_t); +void hibernate_free(void); int hibernate_check_overlap(paddr_t, paddr_t, paddr_t, paddr_t); |