]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: downgrade CPUQuotaPeriodSec= clamping logs to debug 9594/head
authorFilipe Brandenburger <filbranden@google.com>
Thu, 24 Jan 2019 04:19:44 +0000 (20:19 -0800)
committerFilipe Brandenburger <filbranden@google.com>
Thu, 14 Feb 2019 19:04:42 +0000 (11:04 -0800)
After the first warning log, further messages are downgraded to LOG_DEBUG.

src/core/cgroup.c
src/core/dbus-cgroup.c
src/core/unit.h

index 9fe3ba990711332a4a0b68da2b2dfcf011f6df6f..ccf06173db5a5d3dbfc9a9c061f0bd791ccb2770 100644 (file)
@@ -685,9 +685,10 @@ static usec_t cgroup_cpu_adjust_period_and_log(Unit *u, usec_t period, usec_t qu
 
         if (new_period != period) {
                 char v[FORMAT_TIMESPAN_MAX];
-                log_unit_full(u, LOG_WARNING, 0,
+                log_unit_full(u, u->warned_clamping_cpu_quota_period ? LOG_DEBUG : LOG_WARNING, 0,
                               "Clamping CPU interval for cpu.max: period is now %s",
                               format_timespan(v, sizeof(v), new_period, 1));
+                u->warned_clamping_cpu_quota_period = true;
         }
 
         return new_period;
index d1c34fed1b721e87a2580975302f90f2d99dcbae..7ab53a1c2a9c148254ecb1563bc87ea3048c6442 100644 (file)
@@ -714,6 +714,7 @@ int bus_cgroup_set_property(
 
                 if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
                         c->cpu_quota_per_sec_usec = u64;
+                        u->warned_clamping_cpu_quota_period = false;
                         unit_invalidate_cgroup(u, CGROUP_MASK_CPU);
 
                         if (c->cpu_quota_per_sec_usec == USEC_INFINITY)
@@ -737,6 +738,7 @@ int bus_cgroup_set_property(
 
                 if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
                         c->cpu_quota_period_usec = u64;
+                        u->warned_clamping_cpu_quota_period = false;
                         unit_invalidate_cgroup(u, CGROUP_MASK_CPU);
                         if (c->cpu_quota_period_usec == USEC_INFINITY)
                                 unit_write_setting(u, flags, "CPUQuotaPeriodSec", "CPUQuotaPeriodSec=");
index 43cf15715a2c4bd10df99fdccb2873ca1f48e8f6..4d6e6cf46783961660cf3ea6f2cb0d3b38fa2faa 100644 (file)
@@ -349,6 +349,9 @@ typedef struct Unit {
         bool exported_log_rate_limit_interval:1;
         bool exported_log_rate_limit_burst:1;
 
+        /* Whether we warned about clamping the CPU quota period */
+        bool warned_clamping_cpu_quota_period:1;
+
         /* When writing transient unit files, stores which section we stored last. If < 0, we didn't write any yet. If
          * == 0 we are in the [Unit] section, if > 0 we are in the unit type-specific section. */
         signed int last_section_private:2;