Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d4b4c478068cdfd2b2ffe86a776be750779351ba
https://github.com/WebKit/WebKit/commit/d4b4c478068cdfd2b2ffe86a776be750779351ba
Author: Brady Eidson <[email protected]>
Date: 2024-04-28 (Sun, 28 Apr 2024)
Changed paths:
M Source/WTF/wtf/Lock.h
M Source/WTF/wtf/Locker.h
M Source/WTF/wtf/PlatformEnableCocoa.h
M Source/WebKit/Platform/IPC/Connection.cpp
M Source/WebKit/Platform/IPC/Connection.h
Log Message:
-----------
Switch the ConnectionMap lock to os_unfair_lock
rdar://127171137
https://bugs.webkit.org/show_bug.cgi?id=273360
Reviewed by Chris Dumez.
The ConnectionMap is accessed from multiple threads (obviously, since it's
guarded with a lock)
Sometimes, a background thread accessing it is really low priority. e.g. The
"Log Queue" thread.
In these cases, the extremely low priority background thread can be preempted
while holding the lock.
Which causes the main thread to hang when also trying to acquire it, such as
when tearing down a Connection.
This situation was radically improved in https://commits.webkit.org/278072@main
by holding the lock for
a significantly lower amount of time, protecting just the memory reads of a
hash lookup.
But the fundamental problem still exists - Because our standard WTF Lock
"spinlock" doesn't participate in
donation, aren't priority inheriting, etc... The fundamental problem still
exists.
So this patch introduces WTF::UnfairLock to wrap os_unfair_lock, and switches
the ConnectionMap lock to use
it on platforms that support it.
It maintains all the decorations for thread safety analysis, etc.
It also removes some bits from the Connection class itself to reduce the chance
that a client can hog the lock
for longer than necessary going forward.
* Source/WTF/wtf/Lock.h:
* Source/WTF/wtf/Locker.h:
* Source/WTF/wtf/PlatformEnableCocoa.h:
* Source/WebKit/Platform/IPC/Connection.cpp:
(IPC::WTF_REQUIRES_LOCK):
(IPC::Connection::connection):
(IPC::Connection::connectionMap): Deleted.
* Source/WebKit/Platform/IPC/Connection.h:
(IPC::Connection::send):
Canonical link: https://commits.webkit.org/278088@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes