address review comments
This commit is contained in:
parent
61ba4baffa
commit
396ee4ff3d
@ -196,6 +196,7 @@ func (t *TipSetExecutor) ApplyBlocks(ctx context.Context,
|
||||
cronGas = 0
|
||||
partDone = metrics.Timer(ctx, metrics.VMApplyMessages)
|
||||
|
||||
// TODO reorg the code to minimize the execution critical section
|
||||
vmi, err := makeVm(pstate, epoch, ts.MinTimestamp())
|
||||
if err != nil {
|
||||
return cid.Undef, cid.Undef, xerrors.Errorf("making vm: %w", err)
|
||||
|
@ -108,6 +108,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sys vm.Syscal
|
||||
if err != nil {
|
||||
return cid.Undef, fmt.Errorf("creating vm: %w", err)
|
||||
}
|
||||
// Note: genesisVm is mutated, so this has to happen in a deferred func; go horror show.
|
||||
defer func() { genesisVm.Done() }()
|
||||
|
||||
if len(miners) == 0 {
|
||||
|
@ -169,6 +169,7 @@ func (sm *StateManager) callInternal(ctx context.Context, msg *types.Message, pr
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to set up vm: %w", err)
|
||||
}
|
||||
// Note: vmi is mutated, so this has to happen in a deferred func; go horror show.
|
||||
defer func() { vmi.Done() }()
|
||||
|
||||
for i, m := range priorMsgs {
|
||||
|
@ -17,7 +17,13 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// DefaultAvailableExecutionLanes is the number of available execution lanes; it is the bound of
|
||||
// concurrent active executions.
|
||||
// This is the default value in filecoin-ffi
|
||||
DefaultAvailableExecutionLanes = 4
|
||||
// DefaultPriorityExecutionLanes is the number of reserved execution lanes for priority computations.
|
||||
// This is purely userspace, but we believe it is a reasonable default, even with more available
|
||||
// lanes.
|
||||
DefaultPriorityExecutionLanes = 2
|
||||
)
|
||||
|
||||
@ -118,7 +124,7 @@ func (e *executionEnv) getToken(lane ExecutionLane) *executionToken {
|
||||
|
||||
e.available--
|
||||
|
||||
metricsUp(metrics.VMExecutionActive, lane)
|
||||
metricsUp(metrics.VMExecutionRunning, lane)
|
||||
return &executionToken{lane: lane, reserved: 0}
|
||||
|
||||
case ExecutionLanePriority:
|
||||
@ -134,7 +140,7 @@ func (e *executionEnv) getToken(lane ExecutionLane) *executionToken {
|
||||
reserving = 1
|
||||
}
|
||||
|
||||
metricsUp(metrics.VMExecutionActive, lane)
|
||||
metricsUp(metrics.VMExecutionRunning, lane)
|
||||
return &executionToken{lane: lane, reserved: reserving}
|
||||
|
||||
default:
|
||||
@ -152,7 +158,7 @@ func (e *executionEnv) putToken(token *executionToken) {
|
||||
|
||||
e.cond.Broadcast()
|
||||
|
||||
metricsDown(metrics.VMExecutionActive, token.lane)
|
||||
metricsDown(metrics.VMExecutionRunning, token.lane)
|
||||
}
|
||||
|
||||
func metricsUp(metric *stats.Int64Measure, lane ExecutionLane) {
|
||||
|
@ -37,7 +37,7 @@ type Interface interface {
|
||||
Flush(ctx context.Context) (cid.Cid, error)
|
||||
}
|
||||
|
||||
// Executor is the general vm execution interface, which is prioritized according to execution langes.
|
||||
// Executor is the general vm execution interface, which is prioritized according to execution lanes.
|
||||
// User must call Done when it is done with this executor to release resource holds by the execution
|
||||
// environment
|
||||
type Executor interface {
|
||||
|
@ -125,7 +125,7 @@ var (
|
||||
VMSends = stats.Int64("vm/sends", "Counter for sends processed by the VM", stats.UnitDimensionless)
|
||||
VMApplied = stats.Int64("vm/applied", "Counter for messages (including internal messages) processed by the VM", stats.UnitDimensionless)
|
||||
VMExecutionWaiting = stats.Int64("vm/execution_waiting", "Counter for VM executions waiting to be assigned to a lane", stats.UnitDimensionless)
|
||||
VMExecutionActive = stats.Int64("vm/execution_default", "Counter for active VM executions", stats.UnitDimensionless)
|
||||
VMExecutionRunning = stats.Int64("vm/execution_running", "Counter for running VM executions", stats.UnitDimensionless)
|
||||
|
||||
// miner
|
||||
WorkerCallsStarted = stats.Int64("sealing/worker_calls_started", "Counter of started worker tasks", stats.UnitDimensionless)
|
||||
@ -373,8 +373,8 @@ var (
|
||||
Aggregation: view.LastValue(),
|
||||
TagKeys: []tag.Key{ExecutionLane},
|
||||
}
|
||||
VMExecutionActiveView = &view.View{
|
||||
Measure: VMExecutionActive,
|
||||
VMExecutionRunningView = &view.View{
|
||||
Measure: VMExecutionRunning,
|
||||
Aggregation: view.LastValue(),
|
||||
TagKeys: []tag.Key{ExecutionLane},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user