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

Issue 1151353003: [scheduler]: Avoid waking up the scheduler to end long idle periods. (Closed)

Created:
5 years, 7 months ago by rmcilroy
Modified:
5 years, 6 months ago
CC:
chromium-reviews, tracing+reviews_chromium.org, wfh+watch_chromium.org, erikwright+watch_chromium.org, scheduler-bugs_chromium.org, Hannes Payer (out of office), shrike
Base URL:
https://chromium.googlesource.com/chromium/src.git@end_idle_sync_2
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[scheduler]: Avoid waking up the scheduler to end long idle periods. Reworks the IdleHandler logic to avoid waking the scheduler just to end idle periods. The new approach avoids posting delayed tasks on the control queue and instead registers the IdleHandler as a TaskObserver on the message loop, and checks at the end of each task whether the idle period should end. Also adds a SingleThreadIdleTaskRunner::Observer, which gets notified when idle tasks are posted or run. The IdleHelper uses this to decide when to restart a long-idle period or when to pause long idle period ticks (e.g., if there are currently no idle tasks queued to be run). This new model also allow better tracing of idle periods, and the async idle period tracing code has been improved to use nestable async events, and to only show "DeadlineOverrun" events if there is actually a idle task running. Finally adds TRACE_EVENT_NESTABLE_ASYNC_BEGIN/END_WITH_TIMESTAMP0 to trace_events.h which is required as part of this change. BUG=485371, 493350 Committed: https://crrev.com/db151ad312913a65a1d4d7d795ca874f644142e0 Cr-Commit-Position: refs/heads/master@{#332414}

Patch Set 1 : #

Total comments: 40

Patch Set 2 : Rebased #

Patch Set 3 : Review comments. #

Total comments: 11

Patch Set 4 : Review comments. #

Total comments: 8

Patch Set 5 : Fix tests and update for review. #

Total comments: 12

Patch Set 6 : Rebased #

Patch Set 7 : Address review comments. #

Total comments: 2

Patch Set 8 : Fix ASAN and Windows #

Patch Set 9 : Fix Win for realz hopefully... #

Unified diffs Side-by-side diffs Delta from patch set Stats (+865 lines, -424 lines) Patch
M base/trace_event/trace_event.h View 1 2 3 4 5 6 1 chunk +16 lines, -0 lines 0 comments Download
M components/scheduler/child/idle_helper.h View 1 2 3 4 5 6 7 chunks +68 lines, -18 lines 0 comments Download
M components/scheduler/child/idle_helper.cc View 1 2 3 4 5 6 8 chunks +268 lines, -86 lines 0 comments Download
M components/scheduler/child/idle_helper_unittest.cc View 1 2 3 4 5 6 7 8 30 chunks +262 lines, -133 lines 0 comments Download
M components/scheduler/child/nestable_task_runner_for_test.h View 1 2 3 4 5 2 chunks +8 lines, -2 lines 0 comments Download
M components/scheduler/child/nestable_task_runner_for_test.cc View 1 2 3 4 5 6 7 3 chunks +29 lines, -3 lines 0 comments Download
M components/scheduler/child/null_idle_task_runner.cc View 1 2 1 chunk +1 line, -4 lines 0 comments Download
A components/scheduler/child/pollable_thread_safe_flag.h View 1 2 3 1 chunk +35 lines, -0 lines 0 comments Download
A components/scheduler/child/pollable_thread_safe_flag.cc View 1 2 3 1 chunk +21 lines, -0 lines 0 comments Download
M components/scheduler/child/scheduler_message_loop_delegate.h View 1 2 3 4 5 1 chunk +1 line, -2 lines 0 comments Download
M components/scheduler/child/single_thread_idle_task_runner.h View 1 2 3 4 5 6 3 chunks +25 lines, -2 lines 0 comments Download
M components/scheduler/child/single_thread_idle_task_runner.cc View 1 2 5 chunks +14 lines, -11 lines 0 comments Download
M components/scheduler/child/worker_scheduler_impl.cc View 1 2 1 chunk +1 line, -3 lines 0 comments Download
M components/scheduler/child/worker_scheduler_impl_unittest.cc View 1 2 3 4 11 chunks +46 lines, -85 lines 0 comments Download
M components/scheduler/renderer/renderer_scheduler_impl.h View 1 2 3 3 chunks +2 lines, -19 lines 0 comments Download
M components/scheduler/renderer/renderer_scheduler_impl.cc View 1 2 3 3 chunks +2 lines, -22 lines 0 comments Download
M components/scheduler/renderer/renderer_scheduler_impl_unittest.cc View 1 2 3 4 5 5 chunks +64 lines, -34 lines 0 comments Download
M components/scheduler/scheduler.gypi View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 41 (16 generated)
rmcilroy
This is a reworking of how we end idle periods which avoids the extra wakeups ...
5 years, 7 months ago (2015-05-22 17:01:52 UTC) #2
rmcilroy
+Hannes Just ran this through v8.top25_smooth and it didn't cause any particular impact on idle ...
5 years, 7 months ago (2015-05-26 09:43:16 UTC) #4
Sami
Looks like I had a lot of comments but overall I like the simplifying effect ...
5 years, 7 months ago (2015-05-26 13:35:41 UTC) #5
rmcilroy
https://codereview.chromium.org/1151353003/diff/20001/components/scheduler/child/idle_helper.cc File components/scheduler/child/idle_helper.cc (right): https://codereview.chromium.org/1151353003/diff/20001/components/scheduler/child/idle_helper.cc#newcode198 components/scheduler/child/idle_helper.cc:198: // If the idle period has now been reached, ...
5 years, 7 months ago (2015-05-27 11:58:37 UTC) #6
Sami
https://codereview.chromium.org/1151353003/diff/20001/components/scheduler/child/idle_helper.cc File components/scheduler/child/idle_helper.cc (right): https://codereview.chromium.org/1151353003/diff/20001/components/scheduler/child/idle_helper.cc#newcode248 components/scheduler/child/idle_helper.cc:248: helper_->CheckOnValidThread(); On 2015/05/27 11:58:36, rmcilroy wrote: > On 2015/05/26 ...
5 years, 7 months ago (2015-05-27 12:11:56 UTC) #7
alex clarke (OOO till 29th)
Drive by comments. No need to gate on these. https://codereview.chromium.org/1151353003/diff/60001/components/scheduler/child/idle_helper.cc File components/scheduler/child/idle_helper.cc (right): https://codereview.chromium.org/1151353003/diff/60001/components/scheduler/child/idle_helper.cc#newcode127 components/scheduler/child/idle_helper.cc:127: ...
5 years, 7 months ago (2015-05-27 13:04:17 UTC) #9
rmcilroy
https://codereview.chromium.org/1151353003/diff/20001/components/scheduler/child/idle_helper.cc File components/scheduler/child/idle_helper.cc (right): https://codereview.chromium.org/1151353003/diff/20001/components/scheduler/child/idle_helper.cc#newcode215 components/scheduler/child/idle_helper.cc:215: if (helper_->IsQueueEmpty(idle_queue_index_)) { On 2015/05/27 11:58:36, rmcilroy wrote: > ...
5 years, 7 months ago (2015-05-27 19:17:06 UTC) #10
Sami
Looks pretty good now I think. https://codereview.chromium.org/1151353003/diff/60001/components/scheduler/child/idle_helper.cc File components/scheduler/child/idle_helper.cc (right): https://codereview.chromium.org/1151353003/diff/60001/components/scheduler/child/idle_helper.cc#newcode308 components/scheduler/child/idle_helper.cc:308: DCHECK(new_deadline == idle_period_deadline_); ...
5 years, 6 months ago (2015-05-29 09:38:07 UTC) #12
alex clarke (OOO till 29th)
https://codereview.chromium.org/1151353003/diff/100001/components/scheduler/child/idle_helper.h File components/scheduler/child/idle_helper.h (right): https://codereview.chromium.org/1151353003/diff/100001/components/scheduler/child/idle_helper.h#newcode142 components/scheduler/child/idle_helper.h:142: helper_->CheckOnValidThread(); If you're going to define this inline, you ...
5 years, 6 months ago (2015-05-29 13:24:49 UTC) #13
rmcilroy
+primiano Primiano: could you take a look at the base/trace_event changes please. Alex: could you ...
5 years, 6 months ago (2015-06-01 15:33:22 UTC) #15
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1151353003/140001
5 years, 6 months ago (2015-06-01 15:36:15 UTC) #18
commit-bot: I haz the power
Dry run: CLs for remote refs other than refs/pending/heads/master must contain NOTRY=true and NOPRESUBMIT=true in ...
5 years, 6 months ago (2015-06-01 15:36:17 UTC) #20
alex clarke (OOO till 29th)
LGTM for the test changes.
5 years, 6 months ago (2015-06-01 16:16:56 UTC) #21
Sami
Thanks Ross. Couple of nits and an annoying question about threading. https://codereview.chromium.org/1151353003/diff/140001/components/scheduler/child/idle_helper.cc File components/scheduler/child/idle_helper.cc (right): ...
5 years, 6 months ago (2015-06-01 17:11:58 UTC) #22
Primiano Tucci (use gerrit)
base/trace_event LGTM https://codereview.chromium.org/1151353003/diff/140001/base/trace_event/trace_event.h File base/trace_event/trace_event.h (right): https://codereview.chromium.org/1151353003/diff/140001/base/trace_event/trace_event.h#newcode763 base/trace_event/trace_event.h:763: #define TRACE_EVENT_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0(category_group, name, \ Ok there seems ...
5 years, 6 months ago (2015-06-01 17:20:04 UTC) #23
rmcilroy
https://codereview.chromium.org/1151353003/diff/140001/base/trace_event/trace_event.h File base/trace_event/trace_event.h (right): https://codereview.chromium.org/1151353003/diff/140001/base/trace_event/trace_event.h#newcode763 base/trace_event/trace_event.h:763: #define TRACE_EVENT_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0(category_group, name, \ On 2015/06/01 17:20:04, Primiano Tucci ...
5 years, 6 months ago (2015-06-01 19:12:43 UTC) #24
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1151353003/180001
5 years, 6 months ago (2015-06-01 19:16:17 UTC) #27
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: win_chromium_compile_dbg_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_compile_dbg_ng/builds/44164)
5 years, 6 months ago (2015-06-01 21:10:29 UTC) #29
Sami
Thanks Ross, lgtm! https://codereview.chromium.org/1151353003/diff/140001/components/scheduler/child/idle_helper.cc File components/scheduler/child/idle_helper.cc (right): https://codereview.chromium.org/1151353003/diff/140001/components/scheduler/child/idle_helper.cc#newcode251 components/scheduler/child/idle_helper.cc:251: if (state_.idle_period_paused_flag()) { On 2015/06/01 19:12:43, ...
5 years, 6 months ago (2015-06-02 10:33:16 UTC) #30
rmcilroy
https://codereview.chromium.org/1151353003/diff/180001/components/scheduler/child/idle_helper.cc File components/scheduler/child/idle_helper.cc (right): https://codereview.chromium.org/1151353003/diff/180001/components/scheduler/child/idle_helper.cc#newcode184 components/scheduler/child/idle_helper.cc:184: on_idle_task_posted_closure_.Cancel(); On 2015/06/02 10:33:15, Sami wrote: > I *think* ...
5 years, 6 months ago (2015-06-02 13:35:12 UTC) #32
rmcilroy
5 years, 6 months ago (2015-06-02 13:35:15 UTC) #33
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1151353003/220001
5 years, 6 months ago (2015-06-02 13:36:00 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1151353003/240001
5 years, 6 months ago (2015-06-02 15:01:04 UTC) #39
commit-bot: I haz the power
Committed patchset #9 (id:240001)
5 years, 6 months ago (2015-06-02 17:13:05 UTC) #40
commit-bot: I haz the power
5 years, 6 months ago (2015-06-02 17:13:55 UTC) #41
Message was sent while issue was closed.
Patchset 9 (id:??) landed as
https://crrev.com/db151ad312913a65a1d4d7d795ca874f644142e0
Cr-Commit-Position: refs/heads/master@{#332414}

Powered by Google App Engine
This is Rietveld 408576698