internal/pkg: per-cache SCHED_IDLE
All checks were successful
Test / Create distribution (push) Successful in 1m19s
Test / Sandbox (push) Successful in 3m11s
Test / Hakurei (push) Successful in 4m22s
Test / ShareFS (push) Successful in 4m27s
Test / Sandbox (race detector) (push) Successful in 5m49s
Test / Hakurei (race detector) (push) Successful in 6m48s
Test / Flake checks (push) Successful in 1m27s
All checks were successful
Test / Create distribution (push) Successful in 1m19s
Test / Sandbox (push) Successful in 3m11s
Test / Hakurei (push) Successful in 4m22s
Test / ShareFS (push) Successful in 4m27s
Test / Sandbox (race detector) (push) Successful in 5m49s
Test / Hakurei (race detector) (push) Successful in 6m48s
Test / Flake checks (push) Successful in 1m27s
This is cleaner than setting it globally, and is impossible to race. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -88,10 +88,12 @@ func main() {
|
|||||||
} else if base, err = check.NewAbs(flagBase); err != nil {
|
} else if base, err = check.NewAbs(flagBase); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
cache, err = pkg.Open(ctx, msg, 0, flagCures, base)
|
|
||||||
|
var flags int
|
||||||
if flagIdle {
|
if flagIdle {
|
||||||
pkg.SetSchedIdle = true
|
flags &= pkg.CSchedIdle
|
||||||
}
|
}
|
||||||
|
cache, err = pkg.Open(ctx, msg, flags, flagCures, base)
|
||||||
|
|
||||||
return
|
return
|
||||||
}).Flag(
|
}).Flag(
|
||||||
|
|||||||
@@ -40,9 +40,6 @@ type ExecPath struct {
|
|||||||
W bool
|
W bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSchedIdle is whether to set [ext.SCHED_IDLE] scheduling priority.
|
|
||||||
var SetSchedIdle bool
|
|
||||||
|
|
||||||
// GetArtifactFunc is the function signature of [FContext.GetArtifact].
|
// GetArtifactFunc is the function signature of [FContext.GetArtifact].
|
||||||
type GetArtifactFunc func(Artifact) (*check.Absolute, unique.Handle[Checksum])
|
type GetArtifactFunc func(Artifact) (*check.Absolute, unique.Handle[Checksum])
|
||||||
|
|
||||||
@@ -427,7 +424,6 @@ func (a *execArtifact) makeContainer(
|
|||||||
z.ParentPerm = 0700
|
z.ParentPerm = 0700
|
||||||
z.HostNet = hostNet
|
z.HostNet = hostNet
|
||||||
z.Hostname = "cure"
|
z.Hostname = "cure"
|
||||||
z.SetScheduler = SetSchedIdle
|
|
||||||
z.SchedPolicy = ext.SCHED_IDLE
|
z.SchedPolicy = ext.SCHED_IDLE
|
||||||
if z.HostNet {
|
if z.HostNet {
|
||||||
z.Hostname = "cure-net"
|
z.Hostname = "cure-net"
|
||||||
@@ -609,6 +605,7 @@ func (a *execArtifact) cure(f *FContext, hostNet bool) (err error) {
|
|||||||
); err != nil {
|
); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
z.SetScheduler = f.cache.flags&CSchedIdle != 0
|
||||||
|
|
||||||
var status io.Writer
|
var status io.Writer
|
||||||
if status, err = f.GetStatusWriter(); err != nil {
|
if status, err = f.GetStatusWriter(); err != nil {
|
||||||
|
|||||||
@@ -503,6 +503,10 @@ const (
|
|||||||
// This behaviour significantly reduces performance and is not recommended
|
// This behaviour significantly reduces performance and is not recommended
|
||||||
// outside of testing a custom [Artifact] implementation.
|
// outside of testing a custom [Artifact] implementation.
|
||||||
CValidateKnown = 1 << iota
|
CValidateKnown = 1 << iota
|
||||||
|
|
||||||
|
// CSchedIdle arranges for the [ext.SCHED_IDLE] scheduling priority to be
|
||||||
|
// set for [KindExec] and [KindExecNet] containers.
|
||||||
|
CSchedIdle
|
||||||
)
|
)
|
||||||
|
|
||||||
// Cache is a support layer that implementations of [Artifact] can use to store
|
// Cache is a support layer that implementations of [Artifact] can use to store
|
||||||
|
|||||||
Reference in New Issue
Block a user