lkml.org 
[lkml]   [2011]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: cgroups: Assigning tasks to a cgroup slow and does not scale
From
Date
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



\
 
 \ /
  Last update: 2011-06-04 12:13    [W:0.040 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site