-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
disable-threaded-io.patch
45 lines (39 loc) 路 1.43 KB
/
disable-threaded-io.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
commit f897929a4616f0b0a88bab36c7fc2a9c5bbb3365
Author: LekKit <50500857+LekKit@users.noreply.github.com>
Date: Fri Mar 22 10:05:07 2024 +0200
Disable threaded IO on Serenity
diff --git a/src/threading.c b/src/threading.c
index 98883ed..705749c 100644
--- a/src/threading.c
+++ b/src/threading.c
@@ -318,6 +318,12 @@ void condvar_free(cond_var_t* cond)
// Threadpool task offloading
+// Serenity has serious scheduler issues that cause threadpool to
+// perform very poorly when vCPU is not sleeping.
+// Basically a thread that uses 100% of CPU on Serenity somehow
+// monopolizes host CPU so threadpool/eventloop tasks are timing out.
+
+#ifndef __serenity__
#define WORKER_THREADS 4
#define WORKQUEUE_SIZE 2048
#define WORKQUEUE_MASK (WORKQUEUE_SIZE - 1)
@@ -440,8 +446,11 @@ static void* threadpool_worker(void* ptr)
return ptr;
}
+#endif
+
static bool thread_queue_task(thread_func_t func, void** arg, unsigned arg_count, bool va)
{
+#ifndef __serenity__
DO_ONCE ({
atomic_store_uint32_ex(&pool_run, 1, ATOMIC_RELAXED);
workqueue_init(&pool_wq);
@@ -461,6 +470,9 @@ static bool thread_queue_task(thread_func_t func, void** arg, unsigned arg_count
// Still not queued!
// Assuming entire threadpool is busy, just do a blocking task
DO_ONCE(rvvm_warn("Blocking on workqueue task %p", func));
+#else
+ UNUSED(func); UNUSED(arg); UNUSED(arg_count); UNUSED(va);
+#endif
return false;
}