From 2bb4cc2e5f746f1618eae3341b0349be81ab3309 Mon Sep 17 00:00:00 2001 From: zhongjiawei Date: Tue, 24 Oct 2023 17:21:44 +0800 Subject: [PATCH] runc:fix update rt-runtime-us and rt-period-us failed --- git-commit | 2 +- ...date-rt-runtime-us-and-rt-period-us-.patch | 48 +++++++++++++++++++ runc.spec | 8 +++- series.conf | 1 + 4 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 patch/0151-runc-fix-update-rt-runtime-us-and-rt-period-us-.patch diff --git a/git-commit b/git-commit index e3e96b1..3bd13ef 100644 --- a/git-commit +++ b/git-commit @@ -1 +1 @@ -f4b256352252b0f4f90443c3da5ebc7ed22d52aa +38e276c5f19c44427af007c9c62ea1a9ad168e54 diff --git a/patch/0151-runc-fix-update-rt-runtime-us-and-rt-period-us-.patch b/patch/0151-runc-fix-update-rt-runtime-us-and-rt-period-us-.patch new file mode 100644 index 0000000..f944dc3 --- /dev/null +++ b/patch/0151-runc-fix-update-rt-runtime-us-and-rt-period-us-.patch @@ -0,0 +1,48 @@ +From b8980e0d96ccf21bdda4254f4151097b2815269e Mon Sep 17 00:00:00 2001 +From: zhongjiawei +Date: Tue, 24 Oct 2023 16:51:22 +0800 +Subject: [PATCH] runc: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 b712bd0..5176719 100644 +--- a/libcontainer/cgroups/fs/cpu.go ++++ b/libcontainer/cgroups/fs/cpu.go +@@ -54,16 +54,26 @@ func (s *CpuGroup) ApplyDir(path string, cgroup *configs.Cgroup, pid int) error + } + + func (s *CpuGroup) SetRtSched(path string, cgroup *configs.Cgroup) error { +- if cgroup.Resources.CpuRtPeriod != 0 { +- if err := writeFile(path, "cpu.rt_period_us", strconv.FormatUint(cgroup.Resources.CpuRtPeriod, 10)); err != nil { +- return err ++ var err error ++ if cgroup.Resources.CpuRtRuntime != 0 { ++ if err = writeFile(path, "cpu.rt_runtime_us", strconv.FormatInt(cgroup.Resources.CpuRtRuntime, 10)); err != nil { ++ if cgroup.Resources.CpuRtPeriod != 0 { ++ if err = writeFile(path, "cpu.rt_period_us", strconv.FormatUint(cgroup.Resources.CpuRtPeriod, 10)); err != nil { ++ return err ++ } ++ } ++ if err = writeFile(path, "cpu.rt_runtime_us", strconv.FormatInt(cgroup.Resources.CpuRtRuntime, 10)); err != nil { ++ return err ++ } ++ return nil + } + } +- if cgroup.Resources.CpuRtRuntime != 0 { +- if err := writeFile(path, "cpu.rt_runtime_us", strconv.FormatInt(cgroup.Resources.CpuRtRuntime, 10)); err != nil { ++ if cgroup.Resources.CpuRtPeriod != 0 { ++ if err = writeFile(path, "cpu.rt_period_us", strconv.FormatUint(cgroup.Resources.CpuRtPeriod, 10)); err != nil { + return err + } + } ++ + return nil + } + +-- +2.33.0 + diff --git a/runc.spec b/runc.spec index d473f2d..4452f52 100644 --- a/runc.spec +++ b/runc.spec @@ -4,7 +4,7 @@ Name: docker-runc Version: 1.0.0.rc3 -Release: 314 +Release: 315 Summary: runc is a CLI tool for spawning and running containers according to the OCI specification. License: ASL 2.0 @@ -57,6 +57,12 @@ install -p -m 755 runc $RPM_BUILD_ROOT/%{_bindir}/runc %{_bindir}/runc %changelog +* Tue Oct 24 2023 zhongjiawei - 1.0.0.rc3-315 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix update rt-runtime-us and rt-period-us failed + * Thu Oct 12 2023 zhongjiawei - 1.0.0.rc3-314 - Type:bugfix - ID:NA diff --git a/series.conf b/series.conf index d390ec4..2d52c69 100644 --- a/series.conf +++ b/series.conf @@ -150,4 +150,5 @@ patch/0147-runc-ingore-error-when-force-deleting-a-non-exist-cont.patch patch/0148-runc-delete-invalid-cgroupinfo-logs.patch patch/0149-runc-libct-init-unify-init-fix-its-error-logic.patch patch/0150-runc-freezer-add-delay-after-freeze.patch +patch/0151-runc-fix-update-rt-runtime-us-and-rt-period-us-.patch #end -- Gitee