All of lore.kernel.org
 help / color / mirror / Atom feed
* Short process stall after assigning it to a cgroup
@ 2021-06-14 15:29 Ronny Meeus
       [not found] ` <CAMJ=MEegYBi_G=_nk1jaJh-dtJj59EFs6ehCwP5qSBqEKseQ-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Ronny Meeus @ 2021-06-14 15:29 UTC (permalink / raw)
  To: cgroups-u79uwXL29TY76Z2rM5mHXA

Hello

I want to use cgroups to control my heavy cpuload consuming applications.
All apps are running in the realtime domain and I'm using kernel 4.9
and cgroup v1.

I created a small application that monitors the CPU load (by reading
the /proc filesystem) and when it enters a full load condition, I
dynamically start to put the high consuming processes into a cgroup
(which were created during system start-up). Each process will have
it's own cgroup created under the root-cgroup.

The budget I assign to the process is equal to the budget it has
consumed in the previous measurement interval (for example 5s). As
long as the load continues to be high, I start to gradually reduce the
budget of the cgroup until the system is idle enough.

This works reasonably well, but in some cases I see that a very high
load consuming application is stopped completely at the moment it is
put in a cgroup, although the budget allocated to it is correctly
calculated based on the load it consumed in my previous interval.

An example:
- cpu.rt_period_us = 1000000
- cpu.rt_runtime_us = 400000
I would assume that an application put in a cgroup with this
configuration can consume 40% of the CPU and it actually does. But
sometimes, immediately after the process assignment, it stops for a
short period (something like 1 or 2s) and then starts to consume 40%
again.

Is that expected behavior?

It looks like the "budget" it has consumed in the root-cgroup is taken
into account when it is moved to its own group and this results in the
stall.

Best regards,
Ronny

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-06-25 11:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-14 15:29 Short process stall after assigning it to a cgroup Ronny Meeus
     [not found] ` <CAMJ=MEegYBi_G=_nk1jaJh-dtJj59EFs6ehCwP5qSBqEKseQ-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-06-18  5:32   ` Ronny Meeus
2021-06-23 17:28   ` Michal Koutný
2021-06-25  7:32     ` Ronny Meeus
     [not found]       ` <CAMJ=MEfMSX06-mcKuv54T7_VCCrv8uZsN-e-QiHe8-sx-sXVoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-06-25  8:52         ` Michal Koutný
2021-06-25 11:34           ` Ronny Meeus

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.