← Back to Pull requests

specs-go/config: add Core Scheduling support #1114

Open
kailun-qin opened this pull request with 48 lines diff across 2 files
View on GitHub
kailun-qin kailun-qin commented on Aug 04, 2021 10:20 UTC
Author

Linux kernel 5.14 adds the support for Core Scheduling.

This allows setting and copying core scheduling 'task cookies' between
the container process and the threads (PID), processes (TGID), and
process groups (PGID), which helps define groups of tasks that can be
co-scheduled on the same core. These groups can be specified either for
security usecases or for performance usecases.

https://github.com/opencontainers/runtime-spec/issues/1113

Signed-off-by: Kailun Qin <kailun.qin@intel.com>

Diff: 48 lines (+48 / -0) across 2 files Reviewer: AkihiroSuda Review duration: 2803949m
All Vouch review confidence checks passed
Residual risk 0.07 = Change Risk (0.58) × (1 − Review Confidence (0.87)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.58 · 48 lines diff across 2 files
0.58
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.89 · 5 substantive comment(s)
0.89
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
87%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.233
Sensitive Paths sensitive_paths
0.058
Real PR Conversation Timeline
7 items
kailun-qin kailun-qin commented on Jun 20, 2022 11:04 UTC
Author

Dear spec maintainers, would you please kindly take a look at the proposal when you get a chance? We do have some specific usage and asks here: https://github.com/opencontainers/runtime-spec/issues/1113#issuecomment-1153221877.
Many thanks!

AkihiroSuda AkihiroSuda commented on code on Aug 24, 2022 02:35 UTC
Code Review
specs-go/config.go:1
@@ -75,6 +77,27 @@ type LinuxCapabilities struct {
 	Ambient []string `json:"ambient,omitempty" platform:"linux"`
 }
 
+// LinuxCoreSched defines the Core Scheduling config options for the container.
+type LinuxCoreSched struct {
+	// Create controls whether to create a new unique cookie for the process in the container.
+	Create bool `json:"create,omitempty" platform:"linux"`
+	// ShareTo specifies the PIDs that the core_sched cookie of the current process should push to.
+	ShareTo *LinuxCoreSchedPids `json:"shareTo,omitempty" platform:"linux"`
+	// ShareFrom specifies the PIDs that the core_sched cookie of the current process should pull from.
+	ShareFrom *LinuxCoreSchedPids `json:"shareFrom,omitempty" platform:"linux"`
+}
+
+// LinuxCoreSchedPids defines the PIDs that Core Scheduling supports for setting and copying 'task cookies'.
+// 'PID == 0' implies the current process.
+type LinuxCoreSchedPids struct {
+	// Pids are the threads.
+	Pids []int `json:"pids,omitempty" platform:"linux"`
+	// Tgids are the processes.

Did you mean thread groups?

AkihiroSuda AkihiroSuda commented on code on Aug 24, 2022 02:35 UTC
Code Review
specs-go/config.go:1
@@ -75,6 +77,27 @@ type LinuxCapabilities struct {
 	Ambient []string `json:"ambient,omitempty" platform:"linux"`
 }
 
+// LinuxCoreSched defines the Core Scheduling config options for the container.
+type LinuxCoreSched struct {
+	// Create controls whether to create a new unique cookie for the process in the container.
+	Create bool `json:"create,omitempty" platform:"linux"`
+	// ShareTo specifies the PIDs that the core_sched cookie of the current process should push to.
+	ShareTo *LinuxCoreSchedPids `json:"shareTo,omitempty" platform:"linux"`
+	// ShareFrom specifies the PIDs that the core_sched cookie of the current process should pull from.
+	ShareFrom *LinuxCoreSchedPids `json:"shareFrom,omitempty" platform:"linux"`
+}
+
+// LinuxCoreSchedPids defines the PIDs that Core Scheduling supports for setting and copying 'task cookies'.
+// 'PID == 0' implies the current process.
+type LinuxCoreSchedPids struct {
+	// Pids are the threads.

Did you mean processes?

AkihiroSuda AkihiroSuda commented on code on Aug 24, 2022 02:36 UTC
Code Review
specs-go/config.go:1
@@ -75,6 +77,27 @@ type LinuxCapabilities struct {
 	Ambient []string `json:"ambient,omitempty" platform:"linux"`
 }
 
+// LinuxCoreSched defines the Core Scheduling config options for the container.
+type LinuxCoreSched struct {
+	// Create controls whether to create a new unique cookie for the process in the container.
+	Create bool `json:"create,omitempty" platform:"linux"`
+	// ShareTo specifies the PIDs that the core_sched cookie of the current process should push to.
+	ShareTo *LinuxCoreSchedPids `json:"shareTo,omitempty" platform:"linux"`
+	// ShareFrom specifies the PIDs that the core_sched cookie of the current process should pull from.
+	ShareFrom *LinuxCoreSchedPids `json:"shareFrom,omitempty" platform:"linux"`
+}
+
+// LinuxCoreSchedPids defines the PIDs that Core Scheduling supports for setting and copying 'task cookies'.
+// 'PID == 0' implies the current process.
+type LinuxCoreSchedPids struct {
+	// Pids are the threads.

And in which PIDNS?

AkihiroSuda AkihiroSuda commented on code on Aug 24, 2022 02:37 UTC
Code Review
specs-go/config.go:1
@@ -75,6 +77,27 @@ type LinuxCapabilities struct {
 	Ambient []string `json:"ambient,omitempty" platform:"linux"`
 }
 
+// LinuxCoreSched defines the Core Scheduling config options for the container.
+type LinuxCoreSched struct {
+	// Create controls whether to create a new unique cookie for the process in the container.
+	Create bool `json:"create,omitempty" platform:"linux"`
+	// ShareTo specifies the PIDs that the core_sched cookie of the current process should push to.
+	ShareTo *LinuxCoreSchedPids `json:"shareTo,omitempty" platform:"linux"`
+	// ShareFrom specifies the PIDs that the core_sched cookie of the current process should pull from.
+	ShareFrom *LinuxCoreSchedPids `json:"shareFrom,omitempty" platform:"linux"`
+}
+
+// LinuxCoreSchedPids defines the PIDs that Core Scheduling supports for setting and copying 'task cookies'.
+// 'PID == 0' implies the current process.

What is "current?

kolyshkin kolyshkin commented on Oct 09, 2026 06:14 UTC
Contributor

FWIW the feature is there in the kernel, util-linux has coresched utility to use it. It's also used by containerd and kata-containers. Other software (runc, crun, youki, kubernetes, systemd) do not have any support.

Reviewers
Assignees
kailun-qin kailun-qin
Labels
risk: low confidence: 87.3% reviewed sensitive_module
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 57.9% (MEDIUM) · Higher = larger blast radius
57.9%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 87.3% · Lower = rushed or shallow review
87.3%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 7.4% · Safe to merge
7.4%