mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:38:12 +00:00
Way tighter locking in process creation.
We no longer disable interrupts around the whole affair. Since MM manages per-process data structures, this works quite smoothly now. Only procfs had to be tweaked with an InterruptDisabler.
This commit is contained in:
parent
52607aa086
commit
3a901ae36d
3 changed files with 40 additions and 25 deletions
|
@ -101,6 +101,25 @@ static void undertaker_main()
|
|||
}
|
||||
}
|
||||
|
||||
static void spawn_stress() NORETURN;
|
||||
static void spawn_stress()
|
||||
{
|
||||
dword lastAlloc = sum_alloc;
|
||||
|
||||
for (unsigned i = 0; i < 100; ++i) {
|
||||
int error;
|
||||
Process::createUserProcess("/bin/id", (uid_t)100, (gid_t)100, (pid_t)0, error, nullptr, tty0);
|
||||
kprintf("malloc stats: alloc:%u free:%u\n", sum_alloc, sum_free);
|
||||
kprintf("delta:%u\n", sum_alloc - lastAlloc);
|
||||
lastAlloc = sum_alloc;
|
||||
sleep(600);
|
||||
}
|
||||
for (;;) {
|
||||
asm volatile("hlt");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void init_stage2() NORETURN;
|
||||
static void init_stage2()
|
||||
{
|
||||
|
@ -173,20 +192,6 @@ static void init_stage2()
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef STRESS_TEST_SPAWNING
|
||||
dword lastAlloc = sum_alloc;
|
||||
|
||||
for (unsigned i = 0; i < 100; ++i) {
|
||||
int error;
|
||||
auto* shProcess = Process::createUserProcess("/bin/id", (uid_t)100, (gid_t)100, (pid_t)0, error);
|
||||
kprintf("malloc stats: alloc:%u free:%u\n", sum_alloc, sum_free);
|
||||
kprintf("sizeof(Process):%u\n", sizeof(Process));
|
||||
kprintf("delta:%u\n",sum_alloc - lastAlloc);
|
||||
lastAlloc = sum_alloc;
|
||||
sleep(600);
|
||||
}
|
||||
#endif
|
||||
|
||||
int error;
|
||||
auto* sh0 = Process::createUserProcess("/bin/sh", (uid_t)100, (gid_t)100, (pid_t)0, error, nullptr, tty0);
|
||||
#ifdef SPAWN_MULTIPLE_SHELLS
|
||||
|
@ -195,6 +200,10 @@ static void init_stage2()
|
|||
auto* sh3 = Process::createUserProcess("/bin/sh", (uid_t)100, (gid_t)100, (pid_t)0, error, nullptr, tty3);
|
||||
#endif
|
||||
|
||||
#ifdef STRESS_TEST_SPAWNING
|
||||
Process::createKernelProcess(spawn_stress, "spawn_stress");
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// It would be nice to exit this process, but right now it instantiates all kinds of things.
|
||||
// At the very least it needs to be made sure those things stick around as appropriate.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue