summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel/task_cgroup.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/kernel/task_cgroup.go')
-rw-r--r--pkg/sentry/kernel/task_cgroup.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/task_cgroup.go b/pkg/sentry/kernel/task_cgroup.go
index 25d2504fa..7c138e80f 100644
--- a/pkg/sentry/kernel/task_cgroup.go
+++ b/pkg/sentry/kernel/task_cgroup.go
@@ -85,6 +85,14 @@ func (t *Task) enterCgroupLocked(c Cgroup) {
c.Enter(t)
}
+// +checklocks:t.mu
+func (t *Task) enterCgroupIfNotYetLocked(c Cgroup) {
+ if _, ok := t.cgroups[c]; ok {
+ return
+ }
+ t.enterCgroupLocked(c)
+}
+
// LeaveCgroups removes t out from all its cgroups.
func (t *Task) LeaveCgroups() {
t.mu.Lock()