Messages in this thread | | | Subject | Re: cgroups: Assigning tasks to a cgroup slow and does not scale | From | Mike Galbraith <> | Date | Sat, 04 Jun 2011 12:10:31 +0200 |
| |
On Sat, 2011-06-04 at 10:23 +0200, Martin Baum wrote: > Hello, > > assigning a task to new cgroup takes an unexpected high amount of time > on my system - about 0.05s. Strangely it does it does not scale with > more processes: When I run 10 processes that do nothing but change > their cgroups each cgroup change takes about 0.5 seconds while CPU > usage remains very low. So my system maxes out at 20 cgroup changes > per second while cpu and disk usage remain minimal (according to top). > Is this expected behaviour?
Attaching a task invokes synchronize_rcu() along the way, so yup, it's the expected behavior.
> It is a problem for me: I run a daemon that forks and calls suid for > each request. I want to assign each of these forks to a different > cgroup. However this currently kills performance going down from >100 > req/sec to about 20 req/sec.
You can work around it via static cgroups with an agent waiting inside each one. Tell your agent what to do, he forks off a worker. You can inherit a cgroup quickly, but moving between cgroups is very expensive, as you noticed.
(right way is eventually stop exporting rcu grace periods to userland)
-Mike
| |