1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 14:15:07 +00:00

Kernel: Allocate kernel stacks for threads using the region allocator.

This patch moves away from using kmalloc memory for thread kernel stacks.
This reduces pressure on kmalloc (16 KB per thread adds up fast) and
prevents kernel stack overflow from scribbling all over random unrelated
kernel memory.
This commit is contained in:
Andreas Kling 2019-05-14 11:51:00 +02:00
parent 8c3ad802d8
commit c8a216b107
6 changed files with 65 additions and 24 deletions

View file

@ -552,6 +552,11 @@ Process::Process(String&& name, uid_t uid, gid_t gid, pid_t ppid, RingLevel ring
{
dbgprintf("Process: New process PID=%u with name=%s\n", m_pid, m_name.characters());
if (fork_parent)
m_next_region = fork_parent->m_next_region;
else
m_next_region = LinearAddress(0x10000000);
m_page_directory = PageDirectory::create();
#ifdef MM_DEBUG
dbgprintf("Process %u ctor: PD=%x created\n", pid(), m_page_directory.ptr());
@ -596,12 +601,6 @@ Process::Process(String&& name, uid_t uid, gid_t gid, pid_t ppid, RingLevel ring
m_fds[2].set(*device_to_use_as_tty.open(O_WRONLY).value());
}
if (fork_parent)
m_next_region = fork_parent->m_next_region;
else
m_next_region = LinearAddress(0x10000000);
if (fork_parent) {
m_sid = fork_parent->m_sid;
m_pgid = fork_parent->m_pgid;