[heap] Decrease step size for ScavengeJob observer
Currently this observer uses 80% of initial new space capacity as step size. But this means that after the first minor GC this will most likely decouple from the current new space size since the allocation counter isn't reset after a GC and surviving objects aren't accounted. Use 64K as step-size since this should be large enough to not cause regression but it should still work for Scavenger and Minor MC such that a step invocation will be performed close to reaching 80% of new space capacity. Bug: v8:12612 Change-Id: I4abc17eaeded90e0f72d9467a4410159ef0e6dda Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3879618 Reviewed-by: Omer Katz <omerkatz@chromium.org> Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Dominik Inführ <dinfuehr@chromium.org> Cr-Commit-Position: refs/heads/main@{#83079}
This commit is contained in:
parent
7ed1c5a03b
commit
ead6620e65
@ -193,6 +193,8 @@ class ScavengeTaskObserver final : public AllocationObserver {
|
||||
|
||||
class MinorMCTaskObserver final : public AllocationObserver {
|
||||
public:
|
||||
static constexpr size_t kStepSize = 64 * KB;
|
||||
|
||||
MinorMCTaskObserver(Heap* heap, intptr_t step_size)
|
||||
: AllocationObserver(step_size), heap_(heap) {}
|
||||
|
||||
@ -5471,13 +5473,13 @@ void Heap::SetUpSpaces(LinearAllocationArea& new_allocation_info,
|
||||
// v8_flags.concurrent_minor_mc can then be changed to v8_flags.minor_mc
|
||||
// (here and at the RemoveAllocationObserver call site).
|
||||
minor_mc_task_observer_.reset(
|
||||
new MinorMCTaskObserver(this, MinorMCTaskTriggerSize()));
|
||||
new MinorMCTaskObserver(this, MinorMCTaskObserver::kStepSize));
|
||||
new_space()->AddAllocationObserver(minor_mc_task_observer_.get());
|
||||
} else {
|
||||
// ScavengeJob is used by atomic MinorMC and Scavenger.
|
||||
scavenge_job_.reset(new ScavengeJob());
|
||||
scavenge_task_observer_.reset(new ScavengeTaskObserver(
|
||||
this, ScavengeJob::YoungGenerationTaskTriggerSize(this)));
|
||||
scavenge_task_observer_.reset(
|
||||
new ScavengeTaskObserver(this, ScavengeJob::kStepSize));
|
||||
new_space()->AddAllocationObserver(scavenge_task_observer_.get());
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#ifndef V8_HEAP_SCAVENGE_JOB_H_
|
||||
#define V8_HEAP_SCAVENGE_JOB_H_
|
||||
|
||||
#include "src/common/globals.h"
|
||||
#include "src/tasks/cancelable-task.h"
|
||||
|
||||
namespace v8 {
|
||||
@ -17,16 +18,17 @@ class Isolate;
|
||||
// Scavenge garbage collection. The job posts a foreground task.
|
||||
class ScavengeJob {
|
||||
public:
|
||||
static constexpr size_t kStepSize = 64 * KB;
|
||||
|
||||
ScavengeJob() V8_NOEXCEPT = default;
|
||||
|
||||
void ScheduleTaskIfNeeded(Heap* heap);
|
||||
|
||||
static size_t YoungGenerationTaskTriggerSize(Heap* heap);
|
||||
|
||||
private:
|
||||
class Task;
|
||||
|
||||
static bool YoungGenerationSizeTaskTriggerReached(Heap* heap);
|
||||
static size_t YoungGenerationTaskTriggerSize(Heap* heap);
|
||||
|
||||
void set_task_pending(bool value) { task_pending_ = value; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user