Bug 147841

Summary: Convert all locking and condition variables in WebKit to use fast ParkingLot-based locks and condition variables
Product: WebKit Reporter: Filip Pizlo <fpizlo>
Component: Web Template FrameworkAssignee: Filip Pizlo <fpizlo>
Status: RESOLVED FIXED    
Severity: Normal CC: barraclough, basile_clement, benjamin, commit-queue, ggaren, mark.lam, mhahnenb, mmirman, msaboff, nrotem, oliver, saam, sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 147665, 147908, 147986, 148089, 148140, 148493    
Bug Blocks:    
Attachments:
Description Flags
ParkingLot-based Condition
none
the patch mark.lam: review-

Description Filip Pizlo 2015-08-10 14:03:01 PDT
The grand plan is:

- Make Lock use atomic increments on the fast path and ParkingLot on the slow path.  This will make the fast path a lot better and will reduce the memory usage of Lock.

- Give Lock and ByteLock the ability to act as their own condition variables.

- Create a separate Condition that uses one byte and some ParkingLot magic, for those cases where a separate condition variable is needed.

Then we can remove all uses of std::mutex, std::condition_variable, WTF::Mutex, and WTF::ThreadCondition.
Comment 1 Filip Pizlo 2015-08-13 00:29:40 PDT
Created attachment 258884 [details]
ParkingLot-based Condition
Comment 2 Filip Pizlo 2015-08-13 12:09:25 PDT
Created attachment 258912 [details]
the patch

This patch is good to go assuming we want to land this separately from the patch that replaces all uses of ThreadCondition/std::condition_variable with this.
Comment 3 WebKit Commit Bot 2015-08-13 12:11:05 PDT
Attachment 258912 [details] did not pass style-queue:


ERROR: Source/WTF/wtf/ParkingLot.cpp:561:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
ERROR: Tools/TestWebKitAPI/Tests/WTF/Condition.cpp:68:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
ERROR: Tools/TestWebKitAPI/Tests/WTF/Condition.cpp:83:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
ERROR: Tools/TestWebKitAPI/Tests/WTF/Condition.cpp:91:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
ERROR: Tools/TestWebKitAPI/Tests/WTF/Condition.cpp:115:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
ERROR: Tools/TestWebKitAPI/Tests/WTF/Condition.cpp:122:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
Total errors found: 6 in 11 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Mark Lam 2015-08-13 12:19:23 PDT
Comment on attachment 258912 [details]
the patch

Missing the ChangeLog.
Comment 5 Filip Pizlo 2015-08-13 12:49:07 PDT
Comment on attachment 258912 [details]
the patch

I will submit this patch to a different bug.
Comment 6 Filip Pizlo 2015-08-19 11:19:59 PDT
OK, I think this is done.