Commit 29fc1750 authored by Jon Coppeard's avatar Jon Coppeard
Browse files

Bug 1812267 - Don't allow parallel marking to steal from very small stacks r=sfink

Currently non-parallelizable workloads can perform worse with parallel marking
enabled, particularly with more than two threads. This is because we end up
stealing very frequently when there is no advantage to doing so and this
interrupts marking progress.

I tested several approaches to fixing this but the one that worked best was
simply to disallow stealing from very small stacks.

Depends on D167783

Differential Revision: https://phabricator.services.mozilla.com/D167784
parent 82dbe984
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -1729,8 +1729,15 @@ bool MarkStack::hasEntries(MarkColor color) const {
}

bool MarkStack::hasStealableWork() const {
  // Always leave ourselves with at least one stack entry.
  return wordCountForCurrentColor() > ValueRangeWords;
  // It's not worth the overhead of stealing very few entries. For some
  // (non-parallelizable) workloads this can lead to constantly interrupting
  // marking work and makes parallel marking slower than single threaded.
  constexpr size_t MinStealableWordCount = 12;

  static_assert(MinStealableWordCount >= ValueRangeWords,
                "We must always leave at least one stack entry.");

  return wordCountForCurrentColor() > MinStealableWordCount;
}

MOZ_ALWAYS_INLINE bool MarkStack::indexIsEntryBase(size_t index) const {