From: Nick Downing Date: Sun, 17 Mar 2019 03:16:54 +0000 (+1100) Subject: Fix a bug of requiring a certain amount of free swap, when swap is preallocated X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=746ee16edd8a19e9482052958cf3f26395d73569;p=moveable_pool.git Fix a bug of requiring a certain amount of free swap, when swap is preallocated --- 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