mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Fix some issues uncovered by the spawn stress test.
This commit is contained in:
parent
f6179ad9f9
commit
3f3535213b
Notes:
sideshowbarker
2024-07-19 16:06:57 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3f3535213b8
5 changed files with 9 additions and 7 deletions
|
@ -164,6 +164,7 @@ public:
|
|||
|
||||
void unchecked_append(T&& value)
|
||||
{
|
||||
ASSERT((size() + 1) <= capacity());
|
||||
new (m_impl->slot(m_impl->m_size)) T(move(value));
|
||||
++m_impl->m_size;
|
||||
}
|
||||
|
|
|
@ -189,7 +189,8 @@ void ProcFS::remove_process(Process& process)
|
|||
InterruptDisabler disabler;
|
||||
auto pid = process.pid();
|
||||
auto it = m_pid2inode.find(pid);
|
||||
ASSERT(it != m_pid2inode.end());
|
||||
if (it == m_pid2inode.end())
|
||||
return;
|
||||
bool success = remove_file((*it).value);
|
||||
ASSERT(success);
|
||||
m_pid2inode.remove(pid);
|
||||
|
|
|
@ -690,7 +690,8 @@ Process::~Process()
|
|||
ProcFS::the().remove_process(*this);
|
||||
system.nprocess--;
|
||||
|
||||
gdt_free_entry(selector());
|
||||
if (selector())
|
||||
gdt_free_entry(selector());
|
||||
|
||||
if (m_kernelStack) {
|
||||
kfree(m_kernelStack);
|
||||
|
|
|
@ -34,7 +34,7 @@ word gdt_alloc_entry()
|
|||
|
||||
void gdt_free_entry(word entry)
|
||||
{
|
||||
s_gdt_freelist->append(entry);
|
||||
s_gdt_freelist->unchecked_append(entry);
|
||||
}
|
||||
|
||||
extern "C" void handle_irq();
|
||||
|
|
|
@ -36,14 +36,13 @@ Keyboard* keyboard;
|
|||
static void spawn_stress() NORETURN;
|
||||
static void spawn_stress()
|
||||
{
|
||||
dword lastAlloc = sum_alloc;
|
||||
dword last_sum_alloc = sum_alloc;
|
||||
|
||||
for (unsigned i = 0; i < 10000; ++i) {
|
||||
int error;
|
||||
Process::create_user_process("/bin/true", (uid_t)100, (gid_t)100, (pid_t)0, error, Vector<String>(), Vector<String>(), tty0);
|
||||
kprintf("malloc stats: alloc:%u free:%u eternal:%u ", sum_alloc, sum_free, kmalloc_sum_eternal);
|
||||
kprintf("delta:%u\n", sum_alloc - lastAlloc);
|
||||
lastAlloc = sum_alloc;
|
||||
dbgprintf("malloc stats: alloc:%u free:%u eternal:%u !delta:%u\n", sum_alloc, sum_free, kmalloc_sum_eternal, sum_alloc - last_sum_alloc);
|
||||
last_sum_alloc = sum_alloc;
|
||||
sleep(60);
|
||||
}
|
||||
for (;;) {
|
||||
|
|
Loading…
Reference in a new issue