summaryrefslogtreecommitdiff
path: root/src/core/cgroup.h
diff options
context:
space:
mode:
authorFilipe Brandenburger <filbranden@google.com>2018-11-02 09:21:57 -0700
committerFilipe Brandenburger <filbranden@google.com>2019-02-14 11:04:42 -0800
commit10f28641115733c61754342d5dcbe70b083bea4b (patch)
treef0f8ab9e60ffa381fed0ad638e785ac601d29164 /src/core/cgroup.h
parent7b61ce3c44ef5908e817009ce4f9d2a7a37722be (diff)
downloadsystemd-10f28641115733c61754342d5dcbe70b083bea4b.tar.gz
core: add CPUQuotaPeriodSec=
This new setting allows configuration of CFS period on the CPU cgroup, instead of using a hardcoded default of 100ms. Tested: - Legacy cgroup + Unified cgroup - systemctl set-property - systemctl show - Confirmed that the cgroup settings (such as cpu.cfs_period_ns) were set appropriately, including updating the CPU quota (cpu.cfs_quota_ns) when CPUQuotaPeriodSec= is updated. - Checked that clamping works properly when either period or (quota * period) are below the resolution of 1ms, or if period is above the max of 1s.
Diffstat (limited to 'src/core/cgroup.h')
-rw-r--r--src/core/cgroup.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/cgroup.h b/src/core/cgroup.h
index 266daa20a5..42da777c29 100644
--- a/src/core/cgroup.h
+++ b/src/core/cgroup.h
@@ -83,6 +83,7 @@ struct CGroupContext {
uint64_t cpu_weight;
uint64_t startup_cpu_weight;
usec_t cpu_quota_per_sec_usec;
+ usec_t cpu_quota_period_usec;
uint64_t io_weight;
uint64_t startup_io_weight;
@@ -135,6 +136,8 @@ typedef enum CGroupIPAccountingMetric {
typedef struct Unit Unit;
typedef struct Manager Manager;
+usec_t cgroup_cpu_adjust_period(usec_t period, usec_t quota, usec_t resolution, usec_t max_period);
+
void cgroup_context_init(CGroupContext *c);
void cgroup_context_done(CGroupContext *c);
void cgroup_context_dump(CGroupContext *c, FILE* f, const char *prefix);