[cppgc] Delay cross-thread root marking [v8/v8 : main]

0 views
Skip to first unread message

Michael Lippautz (Gerrit)

unread,
Jun 18, 2024, 11:03:27 AMJun 18
to Omer Katz, V8 LUCI CQ, Hannes Payer, mlippau...@chromium.org, oilpan-r...@chromium.org, v8-re...@googlegroups.com
Attention needed from Omer Katz

Michael Lippautz voted and added 1 comment

Votes added by Michael Lippautz

Commit-Queue+1

1 comment

Patchset-level comments
File-level comment, Patchset 3 (Latest):
Michael Lippautz . resolved

ptal

Open in Gerrit

Related details

Attention is currently required from:
  • Omer Katz
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6e154afdfb6cf7d0b24b9f6a5a237140dfc90ed0
Gerrit-Change-Number: 5630528
Gerrit-PatchSet: 3
Gerrit-Owner: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Omer Katz <omer...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Omer Katz <omer...@chromium.org>
Gerrit-Comment-Date: Tue, 18 Jun 2024 15:03:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
unsatisfied_requirement
open
diffy

Omer Katz (Gerrit)

unread,
Jun 18, 2024, 5:46:49 PMJun 18
to Michael Lippautz, V8 LUCI CQ, Hannes Payer, mlippau...@chromium.org, oilpan-r...@chromium.org, v8-re...@googlegroups.com
Attention needed from Michael Lippautz

Omer Katz added 2 comments

File src/heap/cppgc/marker.h
Line 48, Patchset 3 (Latest): enum class CrossThreadRootMarking {
Omer Katz . unresolved

I'm not sure I see the value in this enum. I think it would the code would be simpler if we just explicitly call `MarkCrossThreadRoots` from the one location that actually uses `kAutomatic`.

File src/heap/cppgc/marker.cc
Line 408, Patchset 3 (Latest): CHECK(visited_cross_thread_persistents_in_atomic_pause_);
Omer Katz . unresolved

Why check this twice (here and line 405 above)?

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Lippautz
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6e154afdfb6cf7d0b24b9f6a5a237140dfc90ed0
Gerrit-Change-Number: 5630528
Gerrit-PatchSet: 3
Gerrit-Owner: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Omer Katz <omer...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
Gerrit-Comment-Date: Tue, 18 Jun 2024 21:46:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Michael Lippautz (Gerrit)

unread,
Jun 19, 2024, 3:24:04 AMJun 19
to Omer Katz, V8 LUCI CQ, Hannes Payer, mlippau...@chromium.org, oilpan-r...@chromium.org, v8-re...@googlegroups.com
Attention needed from Omer Katz

Michael Lippautz voted and added 2 comments

Votes added by Michael Lippautz

Commit-Queue+1

2 comments

File src/heap/cppgc/marker.h
Line 48, Patchset 3 (Latest): enum class CrossThreadRootMarking {
Omer Katz . unresolved

I'm not sure I see the value in this enum. I think it would the code would be simpler if we just explicitly call `MarkCrossThreadRoots` from the one location that actually uses `kAutomatic`.

Michael Lippautz

It keeps the `cppgc` API simple and contained. I think its's beneficial to have one implementation where we don't tear the calls apart. E.g., every now and then we reshuffle testing calls and I think it's nice that some things there stay simple.

File src/heap/cppgc/marker.cc
Line 408, Patchset 3 (Latest): CHECK(visited_cross_thread_persistents_in_atomic_pause_);
Omer Katz . resolved

Why check this twice (here and line 405 above)?

Michael Lippautz

Whoops, done.

Open in Gerrit

Related details

Attention is currently required from:
  • Omer Katz
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6e154afdfb6cf7d0b24b9f6a5a237140dfc90ed0
Gerrit-Change-Number: 5630528
Gerrit-PatchSet: 3
Gerrit-Owner: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Omer Katz <omer...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Omer Katz <omer...@chromium.org>
Gerrit-Comment-Date: Wed, 19 Jun 2024 07:23:59 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Omer Katz <omer...@chromium.org>
unsatisfied_requirement
open
diffy

Omer Katz (Gerrit)

unread,
Jun 19, 2024, 4:09:53 AMJun 19
to Michael Lippautz, V8 LUCI CQ, Hannes Payer, mlippau...@chromium.org, oilpan-r...@chromium.org, v8-re...@googlegroups.com
Attention needed from Michael Lippautz

Omer Katz added 1 comment

File src/heap/cppgc/marker.h
Line 48, Patchset 3: enum class CrossThreadRootMarking {
Omer Katz . unresolved

I'm not sure I see the value in this enum. I think it would the code would be simpler if we just explicitly call `MarkCrossThreadRoots` from the one location that actually uses `kAutomatic`.

Michael Lippautz

It keeps the `cppgc` API simple and contained. I think its's beneficial to have one implementation where we don't tear the calls apart. E.g., every now and then we reshuffle testing calls and I think it's nice that some things there stay simple.

Omer Katz

Users of the standalone library (and most tests iirc) would anyway go through `MarkerBase::FinishMarking`. Do you think calling `MarkCrossThreadRoots` explicitly from `FinishMarking` (e.g. after joining concurrent marking, which would also keep `cppgc` and `cppgc-js` aligned) will degrade the API?

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Lippautz
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6e154afdfb6cf7d0b24b9f6a5a237140dfc90ed0
Gerrit-Change-Number: 5630528
Gerrit-PatchSet: 4
Gerrit-Owner: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Omer Katz <omer...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
Gerrit-Comment-Date: Wed, 19 Jun 2024 08:09:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Michael Lippautz <mlip...@chromium.org>
Comment-In-Reply-To: Omer Katz <omer...@chromium.org>
unsatisfied_requirement
open
diffy

Michael Lippautz (Gerrit)

unread,
Jun 19, 2024, 5:47:34 AMJun 19
to Omer Katz, V8 LUCI CQ, Hannes Payer, mlippau...@chromium.org, oilpan-r...@chromium.org, v8-re...@googlegroups.com
Attention needed from Omer Katz

Michael Lippautz added 1 comment

File src/heap/cppgc/marker.h
Line 48, Patchset 3: enum class CrossThreadRootMarking {
Omer Katz . unresolved

I'm not sure I see the value in this enum. I think it would the code would be simpler if we just explicitly call `MarkCrossThreadRoots` from the one location that actually uses `kAutomatic`.

Michael Lippautz

It keeps the `cppgc` API simple and contained. I think its's beneficial to have one implementation where we don't tear the calls apart. E.g., every now and then we reshuffle testing calls and I think it's nice that some things there stay simple.

Omer Katz

Users of the standalone library (and most tests iirc) would anyway go through `MarkerBase::FinishMarking`. Do you think calling `MarkCrossThreadRoots` explicitly from `FinishMarking` (e.g. after joining concurrent marking, which would also keep `cppgc` and `cppgc-js` aligned) will degrade the API?

Michael Lippautz

It's essentially about putting the call into `FinishMarking()` indeed.

I think the API here for the marker is nicer and better guided than with an extra call.

Open in Gerrit

Related details

Attention is currently required from:
  • Omer Katz
Submit Requirements:
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6e154afdfb6cf7d0b24b9f6a5a237140dfc90ed0
Gerrit-Change-Number: 5630528
Gerrit-PatchSet: 4
Gerrit-Owner: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Omer Katz <omer...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Omer Katz <omer...@chromium.org>
Gerrit-Comment-Date: Wed, 19 Jun 2024 09:47:28 +0000
unsatisfied_requirement
open
diffy

Omer Katz (Gerrit)

unread,
Jun 19, 2024, 5:57:30 AMJun 19
to Michael Lippautz, V8 LUCI CQ, Hannes Payer, mlippau...@chromium.org, oilpan-r...@chromium.org, v8-re...@googlegroups.com
Attention needed from Michael Lippautz

Omer Katz voted and added 2 comments

Votes added by Omer Katz

Code-Review+1

2 comments

Patchset-level comments
File src/heap/cppgc/marker.h
Line 48, Patchset 3: enum class CrossThreadRootMarking {
Omer Katz . resolved

I'm not sure I see the value in this enum. I think it would the code would be simpler if we just explicitly call `MarkCrossThreadRoots` from the one location that actually uses `kAutomatic`.

Michael Lippautz

It keeps the `cppgc` API simple and contained. I think its's beneficial to have one implementation where we don't tear the calls apart. E.g., every now and then we reshuffle testing calls and I think it's nice that some things there stay simple.

Omer Katz

Users of the standalone library (and most tests iirc) would anyway go through `MarkerBase::FinishMarking`. Do you think calling `MarkCrossThreadRoots` explicitly from `FinishMarking` (e.g. after joining concurrent marking, which would also keep `cppgc` and `cppgc-js` aligned) will degrade the API?

Michael Lippautz

It's essentially about putting the call into `FinishMarking()` indeed.

I think the API here for the marker is nicer and better guided than with an extra call.

Omer Katz

I disagree and I think the enum is more noise the value, but it's not worth the time to argue over it.

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Lippautz
Submit Requirements:
  • requirement satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6e154afdfb6cf7d0b24b9f6a5a237140dfc90ed0
Gerrit-Change-Number: 5630528
Gerrit-PatchSet: 4
Gerrit-Owner: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Omer Katz <omer...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
Gerrit-Comment-Date: Wed, 19 Jun 2024 09:57:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Omer Katz (Gerrit)

unread,
Jun 19, 2024, 7:01:37 AMJun 19
to Michael Lippautz, V8 LUCI CQ, Hannes Payer, mlippau...@chromium.org, oilpan-r...@chromium.org, v8-re...@googlegroups.com
Attention needed from Michael Lippautz

Omer Katz voted and added 1 comment

Votes added by Omer Katz

Code-Review+1

1 comment

Patchset-level comments
File-level comment, Patchset 5 (Latest):
Omer Katz . resolved

lgtm, thanks!

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Lippautz
Submit Requirements:
  • requirement satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6e154afdfb6cf7d0b24b9f6a5a237140dfc90ed0
Gerrit-Change-Number: 5630528
Gerrit-PatchSet: 5
Gerrit-Owner: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Omer Katz <omer...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
Gerrit-Comment-Date: Wed, 19 Jun 2024 11:01:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Michael Lippautz (Gerrit)

unread,
Jun 19, 2024, 7:04:06 AMJun 19
to Omer Katz, V8 LUCI CQ, Hannes Payer, mlippau...@chromium.org, oilpan-r...@chromium.org, v8-re...@googlegroups.com

Michael Lippautz voted Commit-Queue+2

Commit-Queue+2
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6e154afdfb6cf7d0b24b9f6a5a237140dfc90ed0
Gerrit-Change-Number: 5630528
Gerrit-PatchSet: 5
Gerrit-Owner: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Omer Katz <omer...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
Gerrit-Comment-Date: Wed, 19 Jun 2024 11:04:01 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

V8 LUCI CQ (Gerrit)

unread,
Jun 19, 2024, 7:33:17 AMJun 19
to Michael Lippautz, Omer Katz, Hannes Payer, mlippau...@chromium.org, oilpan-r...@chromium.org, v8-re...@googlegroups.com

V8 LUCI CQ submitted the change

Change information

Commit message:
[cppgc] Delay cross-thread root marking

Cross-thread roots (CrossThreadPersistent and
WeakCrossThreadPersistent) marking and weakness clearing requires
obtaining a lock from the GC during the final atomic pause. The same
lock is used for creating these references. This way we ensure that
the GC doesn't reclaim objects that are held by other threads. It also
ensures that converting a weak into a strong persistent is consistent
wrt to GC running on a different thread.

In order to minimize the impact of this lock we already delayed the
acquisition in GC till we were done marking all CppHeap objects.
However, there may be a lot of JS objects left which can cause quite a
large window where this lock is taken.

This CL only acquires the lock at the very end of marking when
everything else is marked. There will usually not be many objects left
to be marked from this root set.

In addition, we clear cross-thread weak roots immediately durng weak
roots processing which allows us to further shrink down the time
window where the GC holds the lock.
Bug: 347686125, 345117891
Change-Id: I6e154afdfb6cf7d0b24b9f6a5a237140dfc90ed0
Reviewed-by: Omer Katz <omer...@chromium.org>
Commit-Queue: Michael Lippautz <mlip...@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94532}
Files:
  • M src/heap/cppgc-js/cpp-heap.cc
  • M src/heap/cppgc-js/cpp-heap.h
  • M src/heap/cppgc/marker.cc
  • M src/heap/cppgc/marker.h
  • M src/heap/mark-compact.cc
  • M src/heap/minor-mark-sweep.cc
Change size: M
Delta: 6 files changed, 59 insertions(+), 32 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Omer Katz
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6e154afdfb6cf7d0b24b9f6a5a237140dfc90ed0
Gerrit-Change-Number: 5630528
Gerrit-PatchSet: 6
Gerrit-Owner: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Michael Lippautz <mlip...@chromium.org>
Gerrit-Reviewer: Omer Katz <omer...@chromium.org>
Gerrit-CC: Hannes Payer <hpa...@chromium.org>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages