ghaerr / elks

Embeddable Linux Kernel Subset - Linux for 8086
Other
999 stars 108 forks source link

[cmds,kernel] Add meminfo -m option to display sorted main memory segments #2023

Closed ghaerr closed 1 week ago

ghaerr commented 1 week ago

Adds meminfo -m to display all main memory usage sorted by segment address.

This option allows for easier-to-visualize main memory usage by address, for looking at how much main memory is used by applications and the sizes of the blocks beside each segment. It can also be used for system tuning when adjusting /bootopts parameters for seeing the memory blocks used by or available to applications, buffers and UMB.

The internal memory list is subsorted based on seg_add at boot, so there may an address which appears out of order, which is the case for the INITPROC used-once segment released at the end of kernel initialization (see below for screenshot).

Also cleaned up mem.c considerably, reducing code size.

Here's meminfo -m running with UMB with two sorted segment lists; the last two lines are the freed INITPROC segment, now being occupied by /bin/init code followed by some free space:

meminfo -m