[systemd-devel] [PATCH] core: don't complain if cgroup property is missing

Lennart Poettering lennart at poettering.net
Thu Aug 14 17:42:01 PDT 2014


On Tue, 15.07.14 11:53, Umut Tezduyar Lindskog (umut.tezduyar at axis.com) wrote:

Looks Ok, but doesn't apply to currently git anymore...

It's really awful though that the kernel returns EACESS on these. I
wished it would return ENOTSUP or so!

> ---
>  src/core/cgroup.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/core/cgroup.c b/src/core/cgroup.c
> index cd67963..ed5687d 100644
> --- a/src/core/cgroup.c
> +++ b/src/core/cgroup.c
> @@ -303,12 +303,12 @@ void cgroup_context_apply(CGroupContext *c, CGroupControllerMask mask, const cha
>                          state == MANAGER_STARTING && c->startup_cpu_shares != (unsigned long) -1 ? c->startup_cpu_shares :
>                          c->cpu_shares != (unsigned long) -1 ? c->cpu_shares : 1024);
>                  r = cg_set_attribute("cpu", path, "cpu.shares", buf);
> -                if (r < 0)
> +                if (r < 0 && r != -EACCES)
>                          log_warning("Failed to set cpu.shares on %s: %s", path, strerror(-r));
>  
>                  sprintf(buf, USEC_FMT "\n", CGROUP_CPU_QUOTA_PERIOD_USEC);
>                  r = cg_set_attribute("cpu", path, "cpu.cfs_period_us", buf);
> -                if (r < 0)
> +                if (r < 0 && r != -EACCES)
>                          log_warning("Failed to set cpu.cfs_period_us on %s: %s", path, strerror(-r));
>  
>                  if (c->cpu_quota_per_sec_usec != (usec_t) -1) {
> @@ -316,7 +316,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupControllerMask mask, const cha
>                          r = cg_set_attribute("cpu", path, "cpu.cfs_quota_us", buf);
>                  } else
>                          r = cg_set_attribute("cpu", path, "cpu.cfs_quota_us", "-1");
> -                if (r < 0)
> +                if (r < 0 && r != -EACCES)
>                          log_warning("Failed to set cpu.cfs_quota_us on %s: %s", path, strerror(-r));
>          }
>  


Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list