<div dir="ltr"><div><div><div>Any idea or feedback for the person to contact?<br></div>Thanks<br><br></div>br<br></div>rb<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 14, 2016 at 5:21 PM, Rahul Bhattacharya <span dir="ltr"><<a href="mailto:rahulimpdocs@gmail.com" target="_blank">rahulimpdocs@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><pre>When I try to move a RT task to a different cgroup(shown below) I get a EINVAL error.<br></pre><pre>However I can change the cgroup first and then change the sched policy.<br></pre><pre>After looking into kernel source code(<i>I dont use CONFIG_RT_GROUP_SCHED config</i>) I was able to extract this piece of logic</pre><pre><br><br><b>chrt -p 777</b>
pid 777's current scheduling policy: SCHED_OTHER
pid 777's current scheduling priority: 0
<b>cat /proc/777/cgroup</b>
2:cpu,cpuacct:/system.slice
1:name=systemd:/system.slice/<wbr>d.service
<br><b>chrt -f -p 50 777</b>
root@mgu-high:~# chrt -p 777
pid 777's current scheduling policy: SCHED_FIFO
pid 777's current scheduling priority: 50
<b>/bin/echo 777>/sys/fs/cgroup/cpu,<wbr>cpuacct/interaction.slice/<wbr>tasks</b>
<span style="background-color:rgb(224,102,102)"><b>echo: write error: Invalid argument</b></span>
<br><br><br></pre><pre>After browsing kernel sources I was able to find out the reason of failure.<br></pre><pre><br>static int cpu_cgroup_can_attach(struct cgroup_subsys_state *css,<br>                                 struct cgroup_taskset *tset)<br>{<br>        struct task_struct *task;<br><br>                <br>        cgroup_taskset_for_each(task, tset) {<br>#ifdef CONFIG_RT_GROUP_SCHED<br>                if (!sched_rt_can_attach(css_tg(<wbr>css), task))<br>                        return -EINVAL;<br>#else<br>                <b>/* We don't support RT-tasks being in separate groups */<br>                if (task->sched_class != &fair_sched_class)<br>                {<br>                        return -EINVAL;<br>                }</b><br>#endif<br>        }<br>        return 0;<br>}<br><br></pre><pre>My question is why is this check required? Also, changing cgroups first and then the policy of FIFO works without issue(?) for the task. <br><br></pre><pre>Thanks<br><br><br></pre><pre>br<span class="HOEnZb"><font color="#888888"><br></font></span></pre><span class="HOEnZb"><font color="#888888"><pre>rb<br></pre></font></span></div>
</blockquote></div><br></div>