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

Issue 2017453004: cc: Send notification of tasks completion directly without scheduling.

Created:
4 years, 7 months ago by prashant.n
Modified:
4 years, 6 months ago
Reviewers:
vmpstr, ericrk
CC:
chromium-reviews, cc-bugs_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@worker_origin_split_4
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

cc: Send notification of tasks completion directly without scheduling. In current codebase, UniqueNotifier is used to schedule the notifications. But as the task finished adds this notification by calling PostTask on task runner, we should not need another scheduling in sending the notifications. As following tasks call their own PostTask() for origin thread, they will not be re-entrant. Also as it is PostTask() called from worker thread, it will not be re-entrant to origin thread. So in a way this is re-entrancy safe. Unique notifier schedulers are removed and the needed methods are called inline. required_for_activation_done_task required_for_draw_done_task all_done_task This patch also checks if there is another request to PrepareTiles() and skips notifications associated with previous PrepareTiles() request. BUG=498439 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel

Patch Set 1 #

Total comments: 4

Patch Set 2 : feedback #

Patch Set 3 : feedback #

Total comments: 3

Patch Set 4 : fixed implementation #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+91 lines, -72 lines) Patch
M cc/tiles/tile_manager.h View 1 2 3 4 chunks +9 lines, -10 lines 1 comment Download
M cc/tiles/tile_manager.cc View 1 2 3 7 chunks +82 lines, -62 lines 5 comments Download

Depends on Patchset:

Dependent Patchsets:

Messages

Total messages: 23 (7 generated)
prashant.n
PTAL, if this looks okay, I'll fix the few crashing tests due to this change.
4 years, 7 months ago (2016-05-26 13:37:07 UTC) #3
prashant.n
I guess, we'll not need UniqueNotifier, so should I clean it in this CL itself.
4 years, 7 months ago (2016-05-26 13:44:55 UTC) #4
ericrk
Logic wise, this does seem a lot simpler. That said, I feel like there were ...
4 years, 7 months ago (2016-05-26 22:46:32 UTC) #6
ericrk
https://codereview.chromium.org/2017453004/diff/1/cc/tiles/tile_manager.cc File cc/tiles/tile_manager.cc (right): https://codereview.chromium.org/2017453004/diff/1/cc/tiles/tile_manager.cc#newcode419 cc/tiles/tile_manager.cc:419: DCHECK(tile_task_manager_); Why are we DCHECKing this here? if this ...
4 years, 7 months ago (2016-05-26 22:53:37 UTC) #7
prashant.n
still some work to be done here. https://codereview.chromium.org/2017453004/diff/40001/cc/tiles/tile_manager.cc File cc/tiles/tile_manager.cc (right): https://codereview.chromium.org/2017453004/diff/40001/cc/tiles/tile_manager.cc#newcode657 cc/tiles/tile_manager.cc:657: if (tiles_that_need_to_be_rasterized->size() ...
4 years, 6 months ago (2016-05-27 14:29:22 UTC) #8
prashant.n
ptal.
4 years, 6 months ago (2016-05-30 10:13:52 UTC) #13
prashant.n
https://codereview.chromium.org/2017453004/diff/60001/cc/tiles/tile_manager.h File cc/tiles/tile_manager.h (right): https://codereview.chromium.org/2017453004/diff/60001/cc/tiles/tile_manager.h#newcode333 cc/tiles/tile_manager.h:333: } signals_; 1. From above structure ready_to_activate, ready_to_draw and ...
4 years, 6 months ago (2016-05-30 14:38:27 UTC) #14
prashant.n
ping, vmpstr@ and ericrk@.
4 years, 6 months ago (2016-06-01 06:33:03 UTC) #15
vmpstr
I'm not sure about this patch. I kind of like the fact that the unique ...
4 years, 6 months ago (2016-06-01 19:57:09 UTC) #16
prashant.n
https://codereview.chromium.org/2017453004/diff/60001/cc/tiles/tile_manager.cc File cc/tiles/tile_manager.cc (right): https://codereview.chromium.org/2017453004/diff/60001/cc/tiles/tile_manager.cc#newcode278 cc/tiles/tile_manager.cc:278: task_runner_->PostTask(FROM_HERE, on_task_set_finished_callback_); Stack unwinding is ensured by PostTask(). This ...
4 years, 6 months ago (2016-06-02 01:16:47 UTC) #17
prashant.n
ping -> vmpstr@, can you pls. comment on? IMO, there would not be a problem.
4 years, 6 months ago (2016-06-07 04:29:50 UTC) #18
vmpstr
I don't really have a strong opinion on this patch. If you can show a ...
4 years, 6 months ago (2016-06-07 18:44:47 UTC) #19
prashant.n
On 2016/06/07 18:44:47, vmpstr wrote: > I don't really have a strong opinion on this ...
4 years, 6 months ago (2016-06-08 03:50:01 UTC) #20
prashant.n
https://codereview.chromium.org/2017453004/diff/60001/cc/tiles/tile_manager.cc File cc/tiles/tile_manager.cc (right): https://codereview.chromium.org/2017453004/diff/60001/cc/tiles/tile_manager.cc#newcode278 cc/tiles/tile_manager.cc:278: task_runner_->PostTask(FROM_HERE, on_task_set_finished_callback_); > What thread is this run on? ...
4 years, 6 months ago (2016-06-08 03:50:23 UTC) #21
vmpstr
On 2016/06/08 03:50:01, prashant.n wrote: > On 2016/06/07 18:44:47, vmpstr wrote: > > I don't ...
4 years, 6 months ago (2016-06-08 17:37:20 UTC) #22
prashant.n
4 years, 6 months ago (2016-06-10 15:17:52 UTC) #23
> 
> If the perf is good, and you feel strongly that this is a better approach,
then
> we can land it.

I checked the perf. Perf is more or less same.

Pls. verify once.

http://storage.googleapis.com/chromium-telemetry/html-results/results-2016-06...
http://storage.googleapis.com/chromium-telemetry/html-results/results-2016-06...
http://storage.googleapis.com/chromium-telemetry/html-results/results-2016-06...
http://storage.googleapis.com/chromium-telemetry/html-results/results-2016-06...
http://storage.googleapis.com/chromium-telemetry/html-results/results-2016-06...

IMO, with this patch one schedule is skipped and have different functions for
handling different notifications so less checking if there are no other
notifications.

> 
> > Basically unique notification per PrepareTiles() is ensured by did_notify_*
> > variables and not by scheduling task by posting it.
> > 
> > 
> > > 
> > > Otherwise, it's a bit easier for me to reason about the UniqueNotifier.
The
> > main
> > > part that makes this code unclear is that we now have if (source_id ==
> > > prepare_tiles_id) checks in all of the completion functions. It takes some
> > > cognitive effort to figure out what's happening in those situations.
> > 
> > The edge case for (prepare_tiles_count_ != source_prepare_tiles_id) was not
> > taken care earlier.
> > 
> > It could happen in the following scenario though it is rare -
> > 1. Origin thread calls PrepareTiles() and suppose at the same time worker
> thread
> > is running TaskSetFinishedTask, but not yet finished.
> > 2. Origin thread calls another PrepareTiles().
> > 3. Now worker thread has finished task TaskSetFinishedTask. So it will
> schedule
> > a callback which was for earlier PrepareTiles().
> > 
> > In above scenario, as per current code, it will send the notification. This
> > patch handles it.
> 
> Yeah, this happens so UniqueNotifier has a callback that is scheduled after we
> called another PrepareTiles, but that's why we check whether we can actually
> activate/ready to draw and things like that in signal handler.

With UniqueNotifier also, the above edge case will happen.

One question - do we want to send the stale notification if another
PrepareTiles() gets called? Because as earlier dependent tasks are processed, so
we have data for generating frame, but that may be little old. This case would
happen if we get PrepareTiles too fast. (may be within frame time 2 times). One
opinion is if we don't send the notification, then may be we will not be able to
finish the next batch tasks within the frame deadline. Kindly suggest.

Powered by Google App Engine
This is Rietveld 408576698