Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kernel] Dynamically allocate task array from bootopts #1839

Merged
merged 2 commits into from
Mar 28, 2024
Merged

[kernel] Dynamically allocate task array from bootopts #1839

merged 2 commits into from
Mar 28, 2024

Conversation

ghaerr
Copy link
Owner

@ghaerr ghaerr commented Mar 28, 2024

This enhancement allows the previously fixed maximum number of ELKS processes to be set in /bootopts, thus allowing for more tasks (sometimes useful in networking), or less (useful for systems with very small amounts of memory).

The default value is still 16. The task structure used to be contained in the kernel data segment, which subtracted from the available heap space used for other resources. It is now allocated from the kernel heap; with each task structure using 876 bytes, they are an expensive resource - 14016 bytes used. (More on PC-98 as its BIOS requires a larger stack size when performing disk I/O).

meminfo now shows the total task allocation bytes as a "TASK" entry so that memory usage can be seen.

The implementation turned out a bit tricky, as the crt0.S startup code used to set the startup SP to the idle task's stack space. The kernel startup now uses the kernel interrupt stack for a temp stack, then switches stacks to the idle task after the /bootopts file has been read and the task array allocated.

ghaerr added 2 commits March 28, 2024 08:36
First step, allocate fixed size array
Rewrite ps and memoinfo to handle variable sized task array
Adjust SETUP_HEAPSIZE for minimal systems
@ghaerr ghaerr merged commit 8bb62d8 into master Mar 28, 2024
2 checks passed
@ghaerr ghaerr deleted the task branch March 28, 2024 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant