cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* cgroups and SCHED_IDLE
@ 2013-06-27 17:17 Holger Brunck
       [not found] ` <51CC7392.8080701-SkAbAL50j+5BDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Holger Brunck @ 2013-06-27 17:17 UTC (permalink / raw)
  To: cgroups-u79uwXL29TY76Z2rM5mHXA; +Cc: Tejun Heo, Germs, Frits (extern)

Hi all,
I entered a problem when using cgroups on a powerpc board, but I think it's a
general problem or question.

Whats the status of tasks which are running with SCHED_IDLE and cgroups? The
kernel configuration for CGROUPS distinguishes between SCHED_OTHER and
SCHED_RT/FIFO. SCHED_IDLE isn't mentioned at all. If I create two threads which
are creating load on the cpu with SCHED_IDLE I see that they are sharing the CPU
load. If I move one of this tasks to a cgroup I saw that afterwards this task
eats up (more or less) all of the CPU load and the other one is starving, even
if both are still SCHED_IDLE.

It's easy to reproduce with this script (at least on my single 32 bit ppc cpu),
which set up a cgroup sets the current shell to SCHED_IDLE, create a task move
this one to the cgroup and start the second one:

mount -t tmpfs cgroup_root /sys/fs/cgroup
mkdir /sys/fs/cgroup/cpu
mount -t cgroup -ocpu none /sys/fs/cgroup/cpu
cd /sys/fs/cgroup/cpu
mkdir browser
echo $$ | xargs chrt -i -p 0
dd if=/dev/zero of=/dev/null &
pgrep ^dd$ > browser/tasks
dd if=/dev/zero of=/dev/null &

If you start top you will see that the first dd process eats up the CPU time.

If you skip moving the task you would see that both tasks consumes the same load.

So my question is. Is this a bug or is it forbidden to move a task into a
specific cgroup? If the second statement is true  then it may be good to deny
such a request e.g.:

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index a7c9e6d..b475315 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2149,6 +2149,11 @@ retry_find_task:
                rcu_read_unlock();
                goto out_unlock_cgroup;
        }
+       if (tsk->policy == SCHED_IDLE) {
+               ret = -EPERM;
+               rcu_read_unlock();
+               goto out_unlock_cgroup;
+       }

        get_task_struct(tsk);
        rcu_read_unlock();

Any opinion on this?

Best regards
Holger

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

end of thread, other threads:[~2013-07-29 15:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-27 17:17 cgroups and SCHED_IDLE Holger Brunck
     [not found] ` <51CC7392.8080701-SkAbAL50j+5BDgjK7y7TUQ@public.gmane.org>
2013-07-01  8:11   ` Holger Brunck
     [not found]     ` <51D139B4.8070407-SkAbAL50j+5BDgjK7y7TUQ@public.gmane.org>
2013-07-23 15:56       ` Tejun Heo
     [not found]         ` <20130723155634.GD18458-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2013-07-29 12:25           ` Holger Brunck
     [not found]             ` <51F65F3D.1080503-SkAbAL50j+5BDgjK7y7TUQ@public.gmane.org>
2013-07-29 14:07               ` Peter Zijlstra
     [not found]                 ` <20130729140723.GB22156-RM5+C6weyIYnLiPH7yDmwOa11wxjtiyuLtmvbW2Dspo@public.gmane.org>
2013-07-29 15:14                   ` Holger Brunck
     [not found]                     ` <51F686E7.6020200-SkAbAL50j+5BDgjK7y7TUQ@public.gmane.org>
2013-07-29 15:25                       ` Peter Zijlstra
     [not found]                         ` <20130729152529.GD22156-RM5+C6weyIYnLiPH7yDmwOa11wxjtiyuLtmvbW2Dspo@public.gmane.org>
2013-07-29 15:54                           ` Holger Brunck
     [not found]                             ` <51F6901B.4070308-SkAbAL50j+5BDgjK7y7TUQ@public.gmane.org>
2013-07-29 15:56                               ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).