From 196b200d0f19c41730db439c62db9b39e424f21f Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 12 Mar 2026 01:14:03 +0900 Subject: container: expose priority and SCHED_OTHER policy The more explicit API removes the arbitrary limit preventing use of SCHED_OTHER (referred to as SCHED_NORMAL in the kernel). This change also exposes priority value to set. Signed-off-by: Ophestra --- internal/outcome/shim.go | 1 + internal/pkg/exec.go | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'internal') diff --git a/internal/outcome/shim.go b/internal/outcome/shim.go index 53b37310..6d3e8d8b 100644 --- a/internal/outcome/shim.go +++ b/internal/outcome/shim.go @@ -274,6 +274,7 @@ func shimEntrypoint(k syscallDispatcher) { cancelContainer.Store(&stop) sp := shimPrivate{k: k, id: state.id} z := container.New(ctx, msg) + z.SetScheduler = state.Shim.SchedPolicy > 0 z.SchedPolicy = state.Shim.SchedPolicy z.Params = *stateParams.params z.Stdin, z.Stdout, z.Stderr = os.Stdin, os.Stdout, os.Stderr diff --git a/internal/pkg/exec.go b/internal/pkg/exec.go index 3bcffafb..998dce70 100644 --- a/internal/pkg/exec.go +++ b/internal/pkg/exec.go @@ -39,8 +39,8 @@ type ExecPath struct { W bool } -// SchedPolicy is the [container] scheduling policy. -var SchedPolicy std.SchedPolicy +// SetSchedIdle is whether to set [std.SCHED_IDLE] scheduling priority. +var SetSchedIdle bool // PromoteLayers returns artifacts with identical-by-content layers promoted to // the highest priority instance, as if mounted via [ExecPath]. @@ -413,7 +413,8 @@ func (a *execArtifact) cure(f *FContext, hostNet bool) (err error) { z.ParentPerm = 0700 z.HostNet = hostNet z.Hostname = "cure" - z.SchedPolicy = SchedPolicy + z.SetScheduler = SetSchedIdle + z.SchedPolicy = std.SCHED_IDLE if z.HostNet { z.Hostname = "cure-net" } -- cgit v1.3.1