From 746ee16edd8a19e9482052958cf3f26395d73569 Mon Sep 17 00:00:00 2001 From: Nick Downing Date: Sun, 17 Mar 2019 14:16:54 +1100 Subject: [PATCH] Fix a bug of requiring a certain amount of free swap, when swap is preallocated --- process.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/process.c b/process.c index 23ca4ab..1cebdc3 100644 --- a/process.c +++ b/process.c @@ -330,7 +330,9 @@ bool process_alloc(struct process *process, int size) { // free up as much core as we need to swap_out = size - core_head.avail; +#ifndef PREALLOCATE_SWAP assert(swap_out <= swap_head.avail); +#endif do_swap_out(swap_out); // allocate core, can't fail @@ -372,7 +374,9 @@ bool process_realloc(struct process *process, int size) { // free up as much core as we need to swap_out = size_change - core_head.avail; +#ifndef PREALLOCATE_SWAP assert(swap_out <= swap_head.avail); +#endif do_swap_out(swap_out); // reallocate core, can't fail @@ -443,6 +447,9 @@ void process_run(struct process *process) { } // free up as much core as we can +#ifndef PREALLOCATE_SWAP + assert(swap_out <= swap_head.avail); +#endif do_swap_out(swap_out); // add to core pool, using dedicated core item -- 2.34.1