runc:fix update rt-runtime-us and rt-period-us failed

This commit is contained in:
zhongjiawei 2023-10-24 16:01:44 +08:00
parent 57204b8d5b
commit 9262b5e859
4 changed files with 57 additions and 2 deletions

View File

@ -1 +1 @@
ba8307fbddb39f7fefd19d8a74f5b99d9851f045
480f9b7358c97f6513661ba862ff25caa05206b8

View File

@ -0,0 +1,48 @@
From 744a90222c009d1cc42c7b3bc43723d6824f2f80 Mon Sep 17 00:00:00 2001
From: zhongjiawei <zhongjiawei1@huawei.com>
Date: Fri, 20 Oct 2023 16:42:02 +0800
Subject: [PATCH] runc:fix update rt-runtime-us and rt-period-us failed
---
libcontainer/cgroups/fs/cpu.go | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/libcontainer/cgroups/fs/cpu.go b/libcontainer/cgroups/fs/cpu.go
index 6c79f899..0b58781d 100644
--- a/libcontainer/cgroups/fs/cpu.go
+++ b/libcontainer/cgroups/fs/cpu.go
@@ -35,16 +35,26 @@ func (s *CpuGroup) Apply(path string, r *configs.Resources, pid int) error {
}
func (s *CpuGroup) SetRtSched(path string, r *configs.Resources) error {
- if r.CpuRtPeriod != 0 {
- if err := cgroups.WriteFile(path, "cpu.rt_period_us", strconv.FormatUint(r.CpuRtPeriod, 10)); err != nil {
- return err
+var err error
+ if r.CpuRtRuntime != 0 {
+ if err = cgroups.WriteFile(path, "cpu.rt_runtime_us", strconv.FormatInt(r.CpuRtRuntime, 10)); err != nil {
+ if r.CpuRtPeriod != 0 {
+ if err = cgroups.WriteFile(path, "cpu.rt_period_us", strconv.FormatUint(r.CpuRtPeriod, 10)); err != nil {
+ return err
+ }
+ }
+ if err = cgroups.WriteFile(path, "cpu.rt_runtime_us", strconv.FormatInt(r.CpuRtRuntime, 10)); err != nil {
+ return err
+ }
+ return nil
}
}
- if r.CpuRtRuntime != 0 {
- if err := cgroups.WriteFile(path, "cpu.rt_runtime_us", strconv.FormatInt(r.CpuRtRuntime, 10)); err != nil {
+ if r.CpuRtPeriod != 0 {
+ if err = cgroups.WriteFile(path, "cpu.rt_period_us", strconv.FormatUint(r.CpuRtPeriod, 10)); err != nil {
return err
}
}
+
return nil
}
--
2.33.0

View File

@ -3,7 +3,7 @@
Name: docker-runc
Version: 1.1.8
Release: 6
Release: 7
Summary: runc is a CLI tool for spawning and running containers according to the OCI specification.
License: ASL 2.0
@ -54,6 +54,12 @@ install -p -m 755 runc $RPM_BUILD_ROOT/%{_bindir}/runc
%{_bindir}/runc
%changelog
* Tue Oct 24 2023 zhongjiawei<zhongjiawei1@huawei.com> - 1.1.8-7
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix update rt-runtime-us and rt-period-us failed
* Thu Oct 12 2023 zhongjiawei<zhongjiawei1@huawei.com> - 1.1.8-6
- Type:bugfix
- ID:NA

View File

@ -27,3 +27,4 @@ patch/0027-runc-libct-fix-shared-pidns-detection.patch
patch/0028-runc-nsenter-cloned_binary-remove-bindfd-logic-entirely.patch
patch/0029-runc-libct-init-unify-init-fix-its-error-logic.patch
patch/0030-runc-Handle-kmem.limit_in_bytes-removal.patch
patch/0031-runc-fix-update-rt-runtime-us-and-rt-period-us-faile.patch