RESOLVED FIXED 174298
It should be easy to decide how WebKit yields
https://bugs.webkit.org/show_bug.cgi?id=174298
Summary It should be easy to decide how WebKit yields
Filip Pizlo
Reported 2017-07-09 11:17:39 PDT
Currently, we call std::this_thread::yield(), which is super silly. In all other regards, we go to the bare metal for threads. We should use a syscall via a WTF abstraction, rather than using a C++ standard library abstraction.
Attachments
the.patch (13.70 KB, patch)
2017-07-09 11:19 PDT, Filip Pizlo
ysuzuki: review+
the patch (35.83 KB, patch)
2017-07-14 14:44 PDT, Filip Pizlo
no flags
the patch (37.95 MB, patch)
2017-07-14 14:50 PDT, Filip Pizlo
saam: review-
the patch (35.84 KB, patch)
2017-07-17 23:15 PDT, Filip Pizlo
saam: review+
patch for landing (35.81 KB, patch)
2017-07-21 12:35 PDT, Filip Pizlo
no flags
Filip Pizlo
Comment 1 2017-07-09 11:19:57 PDT
Created attachment 314950 [details] the.patch I'm still improving this, but it can already be used for yielding experiments.
Filip Pizlo
Comment 2 2017-07-09 17:49:55 PDT
Comment on attachment 314950 [details] the.patch Actually, I like this approach. R? it is.
Build Bot
Comment 3 2017-07-09 17:51:34 PDT
Attachment 314950 [details] did not pass style-queue: ERROR: Source/WTF/benchmarks/ToyLocks.h:121: Wrong number of spaces before statement. (expected: 20) [whitespace/indent] [4] ERROR: Source/WTF/benchmarks/ToyLocks.h:121: Wrong number of spaces before statement. (expected: 20) [whitespace/indent] [4] Total errors found: 2 in 14 files If any of these errors are false positives, please file a bug against check-webkit-style.
Yusuke Suzuki
Comment 4 2017-07-09 18:26:57 PDT
Comment on attachment 314950 [details] the.patch View in context: https://bugs.webkit.org/attachment.cgi?id=314950&action=review r=me with comment about windows fix. > Source/WTF/wtf/Threading.cpp:190 > +void Thread::yield() > +{ > + sched_yield(); > +} `sched_yield` is not defined in Windows. So, let's define this in ThreadingPthreads.cpp. And in ThreadingWin.cpp, let's define it with SwitchToThread().
Filip Pizlo
Comment 5 2017-07-14 14:44:47 PDT
Created attachment 315489 [details] the patch
Filip Pizlo
Comment 6 2017-07-14 14:50:14 PDT
Created attachment 315492 [details] the patch
Saam Barati
Comment 7 2017-07-14 18:32:57 PDT
Comment on attachment 315492 [details] the patch r- for now because this patch contains a bunch of other stuff that appears to be from the WebKit2->WebKit rename and is therefore hard to review.
Filip Pizlo
Comment 8 2017-07-17 23:15:40 PDT
Created attachment 315769 [details] the patch This time, without the ridiculousness.
Build Bot
Comment 9 2017-07-17 23:17:11 PDT
Attachment 315769 [details] did not pass style-queue: ERROR: Source/WTF/benchmarks/ToyLocks.h:121: Wrong number of spaces before statement. (expected: 20) [whitespace/indent] [4] ERROR: Source/WTF/benchmarks/ToyLocks.h:121: Wrong number of spaces before statement. (expected: 20) [whitespace/indent] [4] ERROR: Source/WTF/wtf/LockAlgorithm.h:125: The parameter name "lock" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WTF/wtf/LockAlgorithm.h:131: The parameter name "lock" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WTF/wtf/LockAlgorithm.h:131: The parameter name "fairness" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WTF/wtf/RunLoopTimer.h:33: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 6 in 32 files If any of these errors are false positives, please file a bug against check-webkit-style.
Saam Barati
Comment 10 2017-07-18 00:47:31 PDT
Comment on attachment 315769 [details] the patch r=me. Looks like you may need to do something for windows
Filip Pizlo
Comment 11 2017-07-21 12:35:29 PDT
Created attachment 316113 [details] patch for landing
Build Bot
Comment 12 2017-07-21 12:38:26 PDT
Attachment 316113 [details] did not pass style-queue: ERROR: Source/WTF/benchmarks/ToyLocks.h:121: Wrong number of spaces before statement. (expected: 20) [whitespace/indent] [4] ERROR: Source/WTF/benchmarks/ToyLocks.h:121: Wrong number of spaces before statement. (expected: 20) [whitespace/indent] [4] ERROR: Source/WTF/wtf/LockAlgorithm.h:125: The parameter name "lock" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WTF/wtf/LockAlgorithm.h:131: The parameter name "lock" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WTF/wtf/LockAlgorithm.h:131: The parameter name "fairness" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WTF/wtf/RunLoopTimer.h:33: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 6 in 32 files If any of these errors are false positives, please file a bug against check-webkit-style.
Filip Pizlo
Comment 13 2017-07-22 07:36:59 PDT
Note You need to log in before you can comment on or make changes to this bug.