diff options
author | Maria Matejka <mq@jmq.cz> | 2021-12-01 22:02:42 +0000 |
---|---|---|
committer | Maria Matejka <mq@jmq.cz> | 2021-12-01 22:02:42 +0000 |
commit | 38278d94ba0a179d5eeb061a59850a4e1c150e5b (patch) | |
tree | 20291db7932bc175f4a64b32653394137a536812 | |
parent | b2bac7ae91253b0bd27e9b03ec5fc30ac1522928 (diff) |
No memory unmapping when shutting down
All the memory is just freed implicitly on exit, no need for
page-by-page unmapping.
-rw-r--r-- | sysdep/unix/alloc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sysdep/unix/alloc.c b/sysdep/unix/alloc.c index d18f286b..99bf349c 100644 --- a/sysdep/unix/alloc.c +++ b/sysdep/unix/alloc.c @@ -46,6 +46,8 @@ alloc_sys_page(void) return ptr; } +extern int shutting_down; /* Shutdown requested. */ + void * alloc_page(void) { @@ -58,7 +60,7 @@ alloc_page(void) node *n = HEAD(fp->list); rem_node(n); - if (--fp->cnt < fp->min) + if (!shutting_down && (--fp->cnt < fp->min)) ev_send(&global_work_list, fp->cleanup); void *ptr = n - FP_NODE_OFFSET; @@ -87,7 +89,7 @@ free_page(void *ptr) memset(n, 0, sizeof(node)); add_tail(&fp->list, n); - if (++fp->cnt > fp->max) + if (!shutting_down && (++fp->cnt > fp->max)) ev_send(&global_work_list, fp->cleanup); } else @@ -151,7 +153,7 @@ cleanup_pages(void *data) birdloop_leave(loop); - if (GFP->cnt > GFP->max) + if (!shutting_down && (GFP->cnt > GFP->max)) ev_send(&global_work_list, GFP->cleanup); } |