|
|
52b84b |
From 9d58db234dc9f22a4f551b1b06bd9fc60d085f4d Mon Sep 17 00:00:00 2001
|
|
|
52b84b |
From: Filipe Brandenburger <filbranden@google.com>
|
|
|
52b84b |
Date: Wed, 23 Jan 2019 20:19:44 -0800
|
|
|
52b84b |
Subject: [PATCH] core: downgrade CPUQuotaPeriodSec= clamping logs to debug
|
|
|
52b84b |
|
|
|
52b84b |
After the first warning log, further messages are downgraded to LOG_DEBUG.
|
|
|
52b84b |
|
|
|
52b84b |
(cherry picked from commit 527ede0c638b47b62a87900438a8a09dea42889e)
|
|
|
52b84b |
|
|
|
52b84b |
Related: #1770379
|
|
|
52b84b |
---
|
|
|
52b84b |
src/core/cgroup.c | 3 ++-
|
|
|
52b84b |
src/core/dbus-cgroup.c | 2 ++
|
|
|
52b84b |
src/core/unit.h | 3 +++
|
|
|
52b84b |
3 files changed, 7 insertions(+), 1 deletion(-)
|
|
|
52b84b |
|
|
|
52b84b |
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
|
|
|
52b84b |
index 45fd64a394..f8b351a65d 100644
|
|
|
52b84b |
--- a/src/core/cgroup.c
|
|
|
52b84b |
+++ b/src/core/cgroup.c
|
|
|
52b84b |
@@ -544,9 +544,10 @@ static usec_t cgroup_cpu_adjust_period_and_log(Unit *u, usec_t period, usec_t qu
|
|
|
52b84b |
|
|
|
52b84b |
if (new_period != period) {
|
|
|
52b84b |
char v[FORMAT_TIMESPAN_MAX];
|
|
|
52b84b |
- log_unit_full(u, LOG_WARNING, 0,
|
|
|
52b84b |
+ log_unit_full(u, u->warned_clamping_cpu_quota_period ? LOG_DEBUG : LOG_WARNING, 0,
|
|
|
52b84b |
"Clamping CPU interval for cpu.max: period is now %s",
|
|
|
52b84b |
format_timespan(v, sizeof(v), new_period, 1));
|
|
|
52b84b |
+ u->warned_clamping_cpu_quota_period = true;
|
|
|
52b84b |
}
|
|
|
52b84b |
|
|
|
52b84b |
return new_period;
|
|
|
52b84b |
diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
|
|
|
52b84b |
index c8b918e45d..4555b33b1f 100644
|
|
|
52b84b |
--- a/src/core/dbus-cgroup.c
|
|
|
52b84b |
+++ b/src/core/dbus-cgroup.c
|
|
|
52b84b |
@@ -712,6 +712,7 @@ int bus_cgroup_set_property(
|
|
|
52b84b |
|
|
|
52b84b |
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
|
|
52b84b |
c->cpu_quota_per_sec_usec = u64;
|
|
|
52b84b |
+ u->warned_clamping_cpu_quota_period = false;
|
|
|
52b84b |
unit_invalidate_cgroup(u, CGROUP_MASK_CPU);
|
|
|
52b84b |
|
|
|
52b84b |
if (c->cpu_quota_per_sec_usec == USEC_INFINITY)
|
|
|
52b84b |
@@ -735,6 +736,7 @@ int bus_cgroup_set_property(
|
|
|
52b84b |
|
|
|
52b84b |
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
|
|
52b84b |
c->cpu_quota_period_usec = u64;
|
|
|
52b84b |
+ u->warned_clamping_cpu_quota_period = false;
|
|
|
52b84b |
unit_invalidate_cgroup(u, CGROUP_MASK_CPU);
|
|
|
52b84b |
if (c->cpu_quota_period_usec == USEC_INFINITY)
|
|
|
52b84b |
unit_write_setting(u, flags, "CPUQuotaPeriodSec", "CPUQuotaPeriodSec=");
|
|
|
52b84b |
diff --git a/src/core/unit.h b/src/core/unit.h
|
|
|
52b84b |
index 39179f5fd4..b40ff9b961 100644
|
|
|
52b84b |
--- a/src/core/unit.h
|
|
|
52b84b |
+++ b/src/core/unit.h
|
|
|
52b84b |
@@ -356,6 +356,9 @@ typedef struct Unit {
|
|
|
52b84b |
bool exported_log_rate_limit_interval:1;
|
|
|
52b84b |
bool exported_log_rate_limit_burst:1;
|
|
|
52b84b |
|
|
|
52b84b |
+ /* Whether we warned about clamping the CPU quota period */
|
|
|
52b84b |
+ bool warned_clamping_cpu_quota_period:1;
|
|
|
52b84b |
+
|
|
|
52b84b |
/* When writing transient unit files, stores which section we stored last. If < 0, we didn't write any yet. If
|
|
|
52b84b |
* == 0 we are in the [Unit] section, if > 0 we are in the unit type-specific section. */
|
|
|
52b84b |
int last_section_private:2;
|