Fix a bug of requiring a certain amount of free swap, when swap is preallocated
authorNick Downing <nick@ndcode.org>
Sun, 17 Mar 2019 03:16:54 +0000 (14:16 +1100)
committerNick Downing <nick@ndcode.org>
Sun, 17 Mar 2019 03:24:21 +0000 (14:24 +1100)
process.c

index 23ca4ab..1cebdc3 100644 (file)
--- 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