Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Issue 2786083005: scheduler: Maintain a constant enqueue order for every task (Closed)

Created:
3 years, 8 months ago by Sami
Modified:
3 years, 8 months ago
CC:
chromium-reviews, jam, darin-cc_chromium.org, devtools-reviews_chromium.org, blink-reviews, kinuko+watch, scheduler-bugs_chromium.org, pfeldman
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

scheduler: Maintain a constant enqueue order for every task The scheduler uses a monotonically increasing counter called enqueue order for sorting tasks. This value was previously assigned at post time for immediate tasks and at delay expiration time for delayed tasks. Because expired delayed tasks get processed in a consistent order (i.e., sorted by their delay) within a single task queue, but in a random order between task queues, delayed tasks for the exact same point in time posted two distinct task queues will run in a random order w.r.t. each other. This in turn causes a problem in virtual time scenarios where delayed tasks should behave deterministically. This patch fixes the problem by eliminating the two-phase assignment of enqueue orders to delayed tasks. This was originally added to avoid a flood of expired delayed tasks starving immediate work, but because the selector now makes sure delayed work doesn't starve immediate work and vice versa, this mechanism can be removed. A side effect of this removal is that there is no longer a guarantee that expired delayed tasks won't run before immediate tasks that were posted later. Note that the base::TaskRunner doesn't offer this guarantee either so it shouldn't be relied on. BUG=696001, 701223

Patch Set 1 #

Patch Set 2 : Adjust dchecks #

Patch Set 3 : Comparison bugfix #

Patch Set 4 : Fix comparisons #

Patch Set 5 : Rebased #

Patch Set 6 : Scheduler test pass? #

Patch Set 7 : Android build fix #

Patch Set 8 : Another Android build fix #

Patch Set 9 : Slight cleanup #

Patch Set 10 : Slightly more cleanup #

Patch Set 11 : Clean clean clean #

Patch Set 12 : Let's try this with the setTimeout(0) change #

Patch Set 13 : Rebased, all tests fixed? #

Patch Set 14 : Rebased #

Patch Set 15 : Update VirtualTimeTest #

Total comments: 12

Patch Set 16 : Disable wasm tests #

Patch Set 17 : Rebased #

Patch Set 18 : Review comments #

Patch Set 19 : WASM workaround no longer needed #

Unified diffs Side-by-side diffs Delta from patch set Stats (+319 lines, -305 lines) Patch
M content/browser/devtools/protocol/devtools_protocol_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +2 lines, -4 lines 0 comments Download
M third_party/WebKit/LayoutTests/platform/linux/fast/css/first-of-type-pseudo-class-expected.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/platform/linux/fast/css/last-of-type-pseudo-class-expected.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/enqueue_order.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +27 lines, -14 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/enqueue_order.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +36 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 6 chunks +5 lines, -26 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 16 chunks +52 lines, -71 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 52 chunks +65 lines, -65 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/task_queue_selector.cc View 1 2 3 4 5 6 7 8 9 1 chunk +6 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/task_queue_selector_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 7 chunks +17 lines, -24 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/work_queue.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/work_queue.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 4 chunks +8 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/work_queue_sets_unittest.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +4 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/base/work_queue_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 17 chunks +85 lines, -74 lines 0 comments Download
M third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 76 (71 generated)
Sami
I'm still chasing a couple of layout test failures but I think this is ready ...
3 years, 8 months ago (2017-04-12 15:50:56 UTC) #60
alex clarke (OOO till 29th)
https://codereview.chromium.org/2786083005/diff/280001/third_party/WebKit/Source/platform/scheduler/base/enqueue_order.h File third_party/WebKit/Source/platform/scheduler/base/enqueue_order.h (left): https://codereview.chromium.org/2786083005/diff/280001/third_party/WebKit/Source/platform/scheduler/base/enqueue_order.h#oldcode28 third_party/WebKit/Source/platform/scheduler/base/enqueue_order.h:28: // A 64bit integer used to provide ordering of ...
3 years, 8 months ago (2017-04-13 07:46:01 UTC) #63
Sami
Thanks, all addressed! https://codereview.chromium.org/2786083005/diff/280001/third_party/WebKit/Source/platform/scheduler/base/enqueue_order.h File third_party/WebKit/Source/platform/scheduler/base/enqueue_order.h (left): https://codereview.chromium.org/2786083005/diff/280001/third_party/WebKit/Source/platform/scheduler/base/enqueue_order.h#oldcode28 third_party/WebKit/Source/platform/scheduler/base/enqueue_order.h:28: // A 64bit integer used to ...
3 years, 8 months ago (2017-04-18 10:47:49 UTC) #70
alex clarke (OOO till 29th)
lgtm
3 years, 8 months ago (2017-04-18 10:58:36 UTC) #73
Sami
3 years, 8 months ago (2017-04-26 13:11:22 UTC) #76
For posterity: we decided against offering this ordering guarantee across task
queue since it would basically tie our hands when wanting to schedule distinct
task queues more freely. The specific virtual time issue is addressed by
https://codereview.chromium.org/2841463003/.

Powered by Google App Engine
This is Rietveld 408576698