iankronquist / kernel-of-truth

A simple kernel written in C and a platform to play with x86_64 extensions
MIT License
30 stars 5 forks source link

Explore running kernel under low memory conditions #85

Closed iankronquist closed 7 years ago

iankronquist commented 8 years ago

If you try running the kernel with less than 128MB of ram it panics, probably when trying to extend the kernel heap.

  1. Where is this panic occurring happening?
  2. What can we do to decrease memory usage?

To run qemu with low memory:

make start QEMU_FLAGS='-m 256'

To run bochs with low memory, apply this patch:

diff --git a/bochsrc.txt b/bochsrc.txt
index 7909c72..45b6a82 100644
--- a/bochsrc.txt
+++ b/bochsrc.txt
@@ -2,7 +2,7 @@
 plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, parallel=1, serial=1, gameport=1, iodebug=1
 config_interface: textconfig
 display_library: x
-memory: host=256, guest=256
+memory: host=128, guest=128
 romimage: file="/usr/local/Cellar/bochs/2.6.8/share/bochs/BIOS-bochs-latest"
 vgaromimage: file="/usr/local/Cellar/bochs/2.6.8/share/bochs/VGABIOS-lgpl-latest"
 boot: cdrom

make start-bochs

iankronquist commented 7 years ago

Bug in slab allocator caused it to gobble up physical memory by the megabyte.