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

Issue 2241703002: Add an experiment to redirect SequencedWorkerPool tasks to TaskScheduler. (Closed)

Created:
4 years, 4 months ago by gab
Modified:
4 years, 3 months ago
Reviewers:
danakj, fdoray, brettw, sky
CC:
chromium-reviews, gab+watch_chromium.org, robliao+watch_chromium.org, fdoray+watch_chromium.org, robliao, fdoray, jam
Base URL:
https://chromium.googlesource.com/chromium/src.git@b3_delay_metrics_blocking
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add an experiment to redirect SequencedWorkerPool tasks to TaskScheduler. The experiment is controlled by a static call for the entire process which must be made before any SequencedWorkerPool instance is posted a task (i.e. before it creates a Worker). The experiment being at run-time, sequenced_worker_pool.cc is now divided between the two worlds. DCHECKs were added to associate as many methods as possible to the world they belong to. FYI, the experiment (and TEST= below) will not actually work until https://codereview.chromium.org/2237643002/ or a variant of it lands but this is a stepping stone to getting there and the CLs themselves can land in any order. BUG=622400 TEST= A) "out\Debug\chrome.exe" runs without a problem, BlockingPool tasks execute as normal in chrome://tracing B) "out\Debug\chrome --force-fieldtrials=BrowserScheduler/Enabled/ --force-fieldtrial-params=BrowserScheduler.Enabled:Background/3;3;1;0;10000/BackgroundFileIO/3;3;1;0;10000/Foreground/3;3;1;0;10000/ForegroundFileIO/3;3;1;0;10000/RedirectSequencedWorkerPools/true" runs without a problem and chrome://tracing shows BlockingPool/CachePool/etc. tasks in the TaskScheduler workers :-) Committed: https://crrev.com/5a65a6844ec5348feedb041cad8721ab79715395 Cr-Commit-Position: refs/heads/master@{#413346}

Patch Set 1 #

Total comments: 18

Patch Set 2 : Split PostTask into helpers and add bug comments. #

Total comments: 14

Patch Set 3 : review:brettw/danakj #19-20 #

Patch Set 4 : self-review #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+227 lines, -19 lines) Patch
M base/threading/sequenced_worker_pool.h View 1 2 1 chunk +11 lines, -0 lines 0 comments Download
M base/threading/sequenced_worker_pool.cc View 1 2 3 20 chunks +197 lines, -17 lines 10 comments Download
M chrome/browser/chrome_browser_main.cc View 1 3 chunks +19 lines, -2 lines 0 comments Download

Messages

Total messages: 41 (20 generated)
gab
Dana PTAL. This is the most important review on the stack from me (besides stamping ...
4 years, 4 months ago (2016-08-12 03:42:34 UTC) #5
gab
+sky for chrome_browser_main.cc CC jam/brettw as FYI, redirection to TaskScheduler is happening (albeit still opt-in ...
4 years, 4 months ago (2016-08-12 03:47:35 UTC) #9
sky
This change seems like it good have a big impact. By putting it behind an ...
4 years, 4 months ago (2016-08-12 15:16:06 UTC) #10
gab
On 2016/08/12 15:16:06, sky wrote: > This change seems like it good have a big ...
4 years, 4 months ago (2016-08-12 16:02:27 UTC) #11
brettw
This is adding a lot of code for this experiment in the middle of a ...
4 years, 4 months ago (2016-08-12 17:44:39 UTC) #13
gab
On 2016/08/12 17:44:39, brettw (ping on IM after 24h) wrote: > This is adding a ...
4 years, 4 months ago (2016-08-12 18:49:21 UTC) #14
brettw
On 2016/08/12 18:49:21, gab (OOO Aug 15 - Sep 1) wrote: > On 2016/08/12 17:44:39, ...
4 years, 4 months ago (2016-08-12 19:29:55 UTC) #15
brettw
https://codereview.chromium.org/2241703002/diff/40001/base/threading/sequenced_worker_pool.cc File base/threading/sequenced_worker_pool.cc (right): https://codereview.chromium.org/2241703002/diff/40001/base/threading/sequenced_worker_pool.cc#newcode60 base/threading/sequenced_worker_pool.cc:60: // because the first task was posted and the ...
4 years, 4 months ago (2016-08-12 19:30:00 UTC) #16
gab
Thanks Brett, done, PTAnL. Splitting PostTask() forced an extra AutoUnlock() scope but I still like ...
4 years, 4 months ago (2016-08-12 23:27:46 UTC) #17
gab
On 2016/08/12 23:27:46, gab (OOO Aug 15 - Sep 1) wrote: > Thanks Brett, done, ...
4 years, 4 months ago (2016-08-15 11:59:32 UTC) #18
brettw
https://codereview.chromium.org/2241703002/diff/60001/base/threading/sequenced_worker_pool.cc File base/threading/sequenced_worker_pool.cc (right): https://codereview.chromium.org/2241703002/diff/60001/base/threading/sequenced_worker_pool.cc#newcode800 base/threading/sequenced_worker_pool.cc:800: AutoUnlock unlock(lock_); Sorry to add another pass here. I'm ...
4 years, 4 months ago (2016-08-15 21:02:21 UTC) #19
danakj
Approach LG, wondering about ordering: https://codereview.chromium.org/2241703002/diff/60001/base/threading/sequenced_worker_pool.cc File base/threading/sequenced_worker_pool.cc (right): https://codereview.chromium.org/2241703002/diff/60001/base/threading/sequenced_worker_pool.cc#newcode564 base/threading/sequenced_worker_pool.cc:564: DCHECK_NE(AllPoolsState::REDIRECTED_TO_TASK_SCHEDULER, g_all_pools_state); Run is ...
4 years, 4 months ago (2016-08-15 21:02:52 UTC) #20
gab
Thanks, addressed/replied, PTAnL. https://codereview.chromium.org/2241703002/diff/60001/base/threading/sequenced_worker_pool.cc File base/threading/sequenced_worker_pool.cc (right): https://codereview.chromium.org/2241703002/diff/60001/base/threading/sequenced_worker_pool.cc#newcode564 base/threading/sequenced_worker_pool.cc:564: DCHECK_NE(AllPoolsState::REDIRECTED_TO_TASK_SCHEDULER, g_all_pools_state); On 2016/08/15 21:02:52, danakj ...
4 years, 4 months ago (2016-08-15 21:32:44 UTC) #22
danakj
LGTM % brettw https://codereview.chromium.org/2241703002/diff/60001/base/threading/sequenced_worker_pool.cc File base/threading/sequenced_worker_pool.cc (right): https://codereview.chromium.org/2241703002/diff/60001/base/threading/sequenced_worker_pool.cc#newcode921 base/threading/sequenced_worker_pool.cc:921: DCHECK_NE(AllPoolsState::REDIRECTED_TO_TASK_SCHEDULER, g_all_pools_state); On 2016/08/15 21:32:44, gab ...
4 years, 4 months ago (2016-08-15 22:05:49 UTC) #24
brettw
lgtm
4 years, 4 months ago (2016-08-15 23:06:33 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2241703002/100001
4 years, 4 months ago (2016-08-20 15:20:22 UTC) #33
gab
Just back online for an instant now, will try to land this, amended CL description ...
4 years, 4 months ago (2016-08-20 15:21:31 UTC) #34
commit-bot: I haz the power
Committed patchset #4 (id:100001)
4 years, 4 months ago (2016-08-20 18:30:35 UTC) #36
commit-bot: I haz the power
Patchset 4 (id:??) landed as https://crrev.com/5a65a6844ec5348feedb041cad8721ab79715395 Cr-Commit-Position: refs/heads/master@{#413346}
4 years, 4 months ago (2016-08-20 18:34:15 UTC) #38
fdoray
https://codereview.chromium.org/2241703002/diff/100001/base/threading/sequenced_worker_pool.cc File base/threading/sequenced_worker_pool.cc (right): https://codereview.chromium.org/2241703002/diff/100001/base/threading/sequenced_worker_pool.cc#newcode748 base/threading/sequenced_worker_pool.cc:748: const SequencedTask& sequenced) { This method doesn't honor delays ...
4 years, 3 months ago (2016-08-25 15:14:01 UTC) #40
gab
4 years, 3 months ago (2016-09-07 15:00:10 UTC) #41
Message was sent while issue was closed.
Thanks for the nice post-commit catches :-). Looks like you even followed up
with all of them in my absence on https://codereview.chromium.org/2285633003/ so
yay!

https://codereview.chromium.org/2241703002/diff/100001/base/threading/sequenc...
File base/threading/sequenced_worker_pool.cc (right):

https://codereview.chromium.org/2241703002/diff/100001/base/threading/sequenc...
base/threading/sequenced_worker_pool.cc:673: 
On 2016/08/15 22:05:49, danakj wrote:
> (you added whitespace here as a result)

True, but I kind of think it's cleaner that way as the statement applies to the
whole block not just the following one?

https://codereview.chromium.org/2241703002/diff/100001/base/threading/sequenc...
base/threading/sequenced_worker_pool.cc:748: const SequencedTask& sequenced) {
On 2016/08/25 15:14:01, fdoray wrote:
> This method doesn't honor delays :(

Oops, looks like you're addressing that in
https://codereview.chromium.org/2285633003/? Thanks!

https://codereview.chromium.org/2241703002/diff/100001/base/threading/sequenc...
base/threading/sequenced_worker_pool.cc:775:
.WithShutdownBehavior(task_shutdown_behavior);
On 2016/08/25 15:14:01, fdoray wrote:
> SequencedWorkerPool allows tasks with different shutdown behaviors to be
posted
> to the same sequence. TaskScheduler currently doesn't support that. Do we want
> to DCHECK that this doesn't happen for tasks forwarded to the TaskScheduler?

Yes, let's do that (seems like that's what you're doing in
https://codereview.chromium.org/2285633003/ :-))

https://codereview.chromium.org/2241703002/diff/100001/base/threading/sequenc...
base/threading/sequenced_worker_pool.cc:786: : ExecutionMode::SEQUENCED;
On 2016/08/25 15:14:01, fdoray wrote:
> Should we DCHECK_LE(sequenced_task_runner_map_.size(), 1)? Otherwise, tasks
> posted to different sequences on the same single-threaded SequencedWorkerPool
> may run on different threads.

Good point, I think this is the case in practice so that sounds fine to me.

https://codereview.chromium.org/2241703002/diff/100001/base/threading/sequenc...
base/threading/sequenced_worker_pool.cc:815: ExecutionMode::PARALLEL);
On 2016/08/25 15:14:01, fdoray wrote:
> Should we have a special case for single-threaded SequencedWorkerPools here?

Yes, looks like you got this too :-)

Powered by Google App Engine
This is Rietveld 408576698