Title: [287463] trunk/Source/bmalloc
- Revision
- 287463
- Author
- [email protected]
- Date
- 2021-12-27 22:10:30 -0800 (Mon, 27 Dec 2021)
Log Message
[libpas] Use thread_switch instead of sched_yield
https://bugs.webkit.org/show_bug.cgi?id=234712
Reviewed by Filip Pizlo.
Previously, we received internal reports that sched_yield waits for a long time, and causing a pause
in the client of _javascript_Core, and we switched it to thread_switch in bmalloc::Mutex. We should do
the same thing in libpas too.
* libpas/src/libpas/pas_lock.c:
(pas_lock_lock_slow):
Modified Paths
Diff
Modified: trunk/Source/bmalloc/ChangeLog (287462 => 287463)
--- trunk/Source/bmalloc/ChangeLog 2021-12-28 05:44:18 UTC (rev 287462)
+++ trunk/Source/bmalloc/ChangeLog 2021-12-28 06:10:30 UTC (rev 287463)
@@ -1,3 +1,17 @@
+2021-12-27 Yusuke Suzuki <[email protected]>
+
+ [libpas] Use thread_switch instead of sched_yield
+ https://bugs.webkit.org/show_bug.cgi?id=234712
+
+ Reviewed by Filip Pizlo.
+
+ Previously, we received internal reports that sched_yield waits for a long time, and causing a pause
+ in the client of _javascript_Core, and we switched it to thread_switch in bmalloc::Mutex. We should do
+ the same thing in libpas too.
+
+ * libpas/src/libpas/pas_lock.c:
+ (pas_lock_lock_slow):
+
2021-12-22 Yusuke Suzuki <[email protected]>
[libpas] Make pas_heap_type constant
Modified: trunk/Source/bmalloc/libpas/src/libpas/pas_lock.c (287462 => 287463)
--- trunk/Source/bmalloc/libpas/src/libpas/pas_lock.c 2021-12-28 05:44:18 UTC (rev 287462)
+++ trunk/Source/bmalloc/libpas/src/libpas/pas_lock.c 2021-12-28 06:10:30 UTC (rev 287463)
@@ -28,6 +28,10 @@
#if LIBPAS_ENABLED
#include "pas_lock.h"
+#if PAS_OS(DARWIN)
+#include <mach/mach_traps.h>
+#include <mach/thread_switch.h>
+#endif
#if PAS_USE_SPINLOCKS
@@ -54,8 +58,14 @@
return;
}
- while (!pas_compare_and_swap_bool_weak(&lock->lock, false, true))
+ while (!pas_compare_and_swap_bool_weak(&lock->lock, false, true)) {
+#if PAS_OS(DARWIN)
+ const mach_msg_timeout_t timeoutInMS = 1;
+ thread_switch(MACH_PORT_NULL, SWITCH_OPTION_DEPRESS, timeoutInMS);
+#else
sched_yield();
+#endif
+ }
}
#endif /* PAS_USE_SPINLOCKS */
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes