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

Issue 845543004: Run task queue manager work in batches (Closed)

Created:
5 years, 11 months ago by Sami
Modified:
5 years, 10 months ago
CC:
chromium-reviews, mkwst+moarreviews-renderer_chromium.org, darin-cc_chromium.org, scheduler-bugs_chromium.org, mlamouri+watch-content_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Run task queue manager work in batches This patch lets the task queue manager run more than one posted task per invocation. This helps reduce the overhead of yielding to and from the main message loop and can speed up cases where tasks are posted very frequently. One example is indexeddb, where some operations such as index building can result in 2500 posted tasks/s (Nexus 7). This patch also adds accounting for the desired run time of the next pending delayed task. This information is used to break out of a work batch if a delayed task should be run instead. Doing this avoids adding extra delay to delayed tasks. A potential downside of this change is that it can penalize work that runs on the message loop without going through the task queue manager. Based on performance tests[1], almost all tasks on the renderer main thread are already getting executed by the task queue manager, so I believe this change shouldn't cause a regression. Note that this version of the patch still uses a batch size of 1 while we investigate some mac test failures triggered by larger batch sizes. [1] https://docs.google.com/a/chromium.org/spreadsheets/d/1IJZpBabW1pr4fb2T8BlkleHcOvHYrjvmCx_dLesxfMA/edit#gid=1492760051 BUG=444764, 451593, 453898 Committed: https://crrev.com/a11ff40fc19b20b4b47f6875e81859978be3be84 Cr-Commit-Position: refs/heads/master@{#314364}

Patch Set 1 #

Patch Set 2 : Rebased. #

Total comments: 3

Patch Set 3 : Implement yielding for delayed tasks. #

Patch Set 4 : Header cleanup. #

Total comments: 9

Patch Set 5 : Rebased. #

Patch Set 6 : Review comments. #

Total comments: 2

Patch Set 7 : Added a comment about DoWork(). #

Patch Set 8 : Rebased. #

Patch Set 9 : Reformatted. #

Patch Set 10 : Drop batch size to 1 for now. #

Patch Set 11 : Added ubsan blacklist entry. #

Patch Set 12 : Fix delayed task starvation bug. #

Patch Set 13 : DCHECK tweak. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+222 lines, -36 lines) Patch
M content/renderer/scheduler/renderer_scheduler_impl.h View 1 2 3 4 5 6 7 8 9 4 chunks +6 lines, -3 lines 0 comments Download
M content/renderer/scheduler/renderer_scheduler_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +10 lines, -1 line 0 comments Download
M content/renderer/scheduler/renderer_scheduler_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -17 lines 0 comments Download
M content/renderer/scheduler/task_queue_manager.h View 1 2 5 chunks +21 lines, -1 line 0 comments Download
M content/renderer/scheduler/task_queue_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 10 chunks +76 lines, -14 lines 0 comments Download
M content/renderer/scheduler/task_queue_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +102 lines, -0 lines 0 comments Download
M tools/ubsan/blacklist.txt View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 47 (11 generated)
Sami
5 years, 11 months ago (2015-01-14 17:02:45 UTC) #2
rmcilroy
https://codereview.chromium.org/845543004/diff/20001/content/renderer/scheduler/task_queue_manager.cc File content/renderer/scheduler/task_queue_manager.cc (right): https://codereview.chromium.org/845543004/diff/20001/content/renderer/scheduler/task_queue_manager.cc#newcode347 content/renderer/scheduler/task_queue_manager.cc:347: } Would the following work: if (!UpdateWorkQueues()) return; MaybePostDoWorkOnMainRunner(); ...
5 years, 11 months ago (2015-01-14 17:56:37 UTC) #3
Sami
https://codereview.chromium.org/845543004/diff/20001/content/renderer/scheduler/task_queue_manager.cc File content/renderer/scheduler/task_queue_manager.cc (right): https://codereview.chromium.org/845543004/diff/20001/content/renderer/scheduler/task_queue_manager.cc#newcode347 content/renderer/scheduler/task_queue_manager.cc:347: } I had the same idea and chose to ...
5 years, 11 months ago (2015-01-14 18:11:50 UTC) #4
Sami
On 2015/01/14 18:11:50, Sami wrote: > Let me check how this fares with the indexeddb ...
5 years, 11 months ago (2015-01-14 18:14:40 UTC) #5
rmcilroy
Looks good, but this seems to be breaking TestIdleTaskExceedsDeadline on the bots. I think this ...
5 years, 11 months ago (2015-01-14 19:34:48 UTC) #6
Sami
I've updated the patch to keep track of the next pending delayed task. This adds ...
5 years, 11 months ago (2015-01-19 18:40:17 UTC) #7
picksi1
Interesting stuff! https://codereview.chromium.org/845543004/diff/60001/content/renderer/scheduler/task_queue_manager.cc File content/renderer/scheduler/task_queue_manager.cc (right): https://codereview.chromium.org/845543004/diff/60001/content/renderer/scheduler/task_queue_manager.cc#newcode371 content/renderer/scheduler/task_queue_manager.cc:371: Now() >= next_pending_delayed_task) The checks for i>0 ...
5 years, 11 months ago (2015-01-21 11:16:09 UTC) #9
rmcilroy
Generally looks good to me, but I have a suggestion on moving the priority queue ...
5 years, 11 months ago (2015-01-21 12:18:26 UTC) #10
Sami
Thanks for the comments! https://codereview.chromium.org/845543004/diff/60001/content/renderer/scheduler/task_queue_manager.cc File content/renderer/scheduler/task_queue_manager.cc (right): https://codereview.chromium.org/845543004/diff/60001/content/renderer/scheduler/task_queue_manager.cc#newcode86 content/renderer/scheduler/task_queue_manager.cc:86: std::greater<base::TimeTicks>> delayed_task_run_times_; On 2015/01/21 12:18:26, ...
5 years, 11 months ago (2015-01-21 14:31:16 UTC) #11
rmcilroy
lgtm, thanks! https://codereview.chromium.org/845543004/diff/60001/content/renderer/scheduler/task_queue_manager.cc File content/renderer/scheduler/task_queue_manager.cc (right): https://codereview.chromium.org/845543004/diff/60001/content/renderer/scheduler/task_queue_manager.cc#newcode86 content/renderer/scheduler/task_queue_manager.cc:86: std::greater<base::TimeTicks>> delayed_task_run_times_; On 2015/01/21 14:31:16, Sami wrote: ...
5 years, 11 months ago (2015-01-21 15:13:09 UTC) #12
Sami
https://codereview.chromium.org/845543004/diff/100001/content/renderer/scheduler/task_queue_manager.cc File content/renderer/scheduler/task_queue_manager.cc (right): https://codereview.chromium.org/845543004/diff/100001/content/renderer/scheduler/task_queue_manager.cc#newcode377 content/renderer/scheduler/task_queue_manager.cc:377: MaybePostDoWorkOnMainRunner(); On 2015/01/21 15:13:09, rmcilroy wrote: > Could you ...
5 years, 11 months ago (2015-01-21 15:30:40 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/845543004/120001
5 years, 11 months ago (2015-01-21 15:31:43 UTC) #15
commit-bot: I haz the power
Try jobs failed on following builders: ios_dbg_simulator on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_dbg_simulator/builds/50836) Try jobs failed on following ...
5 years, 11 months ago (2015-01-21 15:34:34 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/845543004/160001
5 years, 11 months ago (2015-01-21 15:47:49 UTC) #19
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/25388)
5 years, 11 months ago (2015-01-21 18:03:54 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/845543004/160001
5 years, 11 months ago (2015-01-21 19:33:01 UTC) #23
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/25367)
5 years, 11 months ago (2015-01-21 19:34:38 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/845543004/160001
5 years, 11 months ago (2015-01-23 14:23:13 UTC) #27
commit-bot: I haz the power
Committed patchset #9 (id:160001)
5 years, 11 months ago (2015-01-23 14:24:29 UTC) #28
commit-bot: I haz the power
Patchset 9 (id:??) landed as https://crrev.com/d9684457b5349dfc1cc19e8a2d98a69ba00ed058 Cr-Commit-Position: refs/heads/master@{#312839}
5 years, 11 months ago (2015-01-23 14:25:28 UTC) #29
jam
A revert of this CL (patchset #9 id:160001) has been created in https://codereview.chromium.org/867353002/ by jam@chromium.org. ...
5 years, 11 months ago (2015-01-23 19:00:01 UTC) #30
jam
On 2015/01/23 19:00:01, jam wrote: > A revert of this CL (patchset #9 id:160001) has ...
5 years, 11 months ago (2015-01-23 20:19:27 UTC) #31
Sami
On 2015/01/23 20:19:27, jam wrote: > On 2015/01/23 19:00:01, jam wrote: > > A revert ...
5 years, 11 months ago (2015-01-25 15:08:44 UTC) #32
rmcilroy
On 2015/01/25 15:08:44, Sami wrote: > On 2015/01/23 20:19:27, jam wrote: > > On 2015/01/23 ...
5 years, 11 months ago (2015-01-25 16:15:17 UTC) #33
Sami
Finally found the magic incantation to make ubsan happy about this patch. Ross, could you ...
5 years, 11 months ago (2015-01-27 12:29:52 UTC) #34
rmcilroy
On 2015/01/27 12:29:52, Sami wrote: > Finally found the magic incantation to make ubsan happy ...
5 years, 11 months ago (2015-01-27 13:30:19 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/845543004/200001
5 years, 11 months ago (2015-01-27 13:31:57 UTC) #37
commit-bot: I haz the power
Committed patchset #11 (id:200001)
5 years, 11 months ago (2015-01-27 14:13:08 UTC) #38
commit-bot: I haz the power
Patchset 11 (id:??) landed as https://crrev.com/42ad8e954a2eafaa52bc3e566747eeb274ad1ad1 Cr-Commit-Position: refs/heads/master@{#313271}
5 years, 11 months ago (2015-01-27 14:14:06 UTC) #39
oystein (OOO til 10th of July)
A revert of this CL (patchset #11 id:200001) has been created in https://codereview.chromium.org/894183002/ by oysteine@chromium.org. ...
5 years, 10 months ago (2015-02-02 20:35:51 UTC) #40
Sami
The problem was that delayed tasks were getting enqueued with a non-zero delayed_run_time after the ...
5 years, 10 months ago (2015-02-03 16:16:21 UTC) #41
rmcilroy
Yikes, good catch on the delayed_runtime - I wonder why this didn't crop up until ...
5 years, 10 months ago (2015-02-03 17:42:01 UTC) #42
Sami
On 2015/02/03 17:42:01, rmcilroy wrote: > Yikes, good catch on the delayed_runtime - I wonder ...
5 years, 10 months ago (2015-02-03 17:50:47 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/845543004/240001
5 years, 10 months ago (2015-02-03 17:52:09 UTC) #45
commit-bot: I haz the power
Committed patchset #13 (id:240001)
5 years, 10 months ago (2015-02-03 17:56:17 UTC) #46
commit-bot: I haz the power
5 years, 10 months ago (2015-02-03 17:57:37 UTC) #47
Message was sent while issue was closed.
Patchset 13 (id:??) landed as
https://crrev.com/a11ff40fc19b20b4b47f6875e81859978be3be84
Cr-Commit-Position: refs/heads/master@{#314364}

Powered by Google App Engine
This is Rietveld 408576698