All of lore.kernel.org
 help / color / mirror / Atom feed
* Changing RT task to a different cgroup
@ 2016-09-14 15:21 Rahul Bhattacharya
  2016-09-20 12:39 ` Rahul Bhattacharya
  0 siblings, 1 reply; 3+ messages in thread
From: Rahul Bhattacharya @ 2016-09-14 15:21 UTC (permalink / raw)
  To: kernelnewbies

When I try to move a RT task to a different cgroup(shown below) I get
a EINVAL error.

However I can change the cgroup first and then change the sched policy.

After looking into kernel source code(*I dont use
CONFIG_RT_GROUP_SCHED config*) I was able to extract this piece of
logic



*chrt -p 777*
pid 777's current scheduling policy: SCHED_OTHER
pid 777's current scheduling priority: 0
*cat /proc/777/cgroup*
2:cpu,cpuacct:/system.slice
1:name=systemd:/system.slice/d.service
*chrt -f -p 50 777*

root at mgu-high:~# chrt -p 777
pid 777's current scheduling policy: SCHED_FIFO
pid 777's current scheduling priority: 50
*/bin/echo 777>/sys/fs/cgroup/cpu,cpuacct/interaction.slice/tasks**echo:
write error: Invalid argument*


After browsing kernel sources I was able to find out the reason of failure.


static int cpu_cgroup_can_attach(struct cgroup_subsys_state *css,
				 struct cgroup_taskset *tset)
{
	struct task_struct *task;

		
	cgroup_taskset_for_each(task, tset) {
#ifdef CONFIG_RT_GROUP_SCHED
		if (!sched_rt_can_attach(css_tg(css), task))
			return -EINVAL;
#else
		



*/* We don't support RT-tasks being in separate groups */		if
(task->sched_class != &fair_sched_class)		{			return -EINVAL;		}*
#endif
	}
	return 0;
}

My question is why is this check required? Also, changing cgroups
first and then the policy of FIFO works without issue(?) for the task.

Thanks


br

rb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160914/6b44141e/attachment.html 

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

* Changing RT task to a different cgroup
  2016-09-14 15:21 Changing RT task to a different cgroup Rahul Bhattacharya
@ 2016-09-20 12:39 ` Rahul Bhattacharya
  2016-09-20 13:09   ` Juan Luis De Sousa-Valadas Castano
  0 siblings, 1 reply; 3+ messages in thread
From: Rahul Bhattacharya @ 2016-09-20 12:39 UTC (permalink / raw)
  To: kernelnewbies

Any idea or feedback for the person to contact?
Thanks

br
rb

On Wed, Sep 14, 2016 at 5:21 PM, Rahul Bhattacharya <rahulimpdocs@gmail.com>
wrote:

> When I try to move a RT task to a different cgroup(shown below) I get a EINVAL error.
>
> However I can change the cgroup first and then change the sched policy.
>
> After looking into kernel source code(*I dont use CONFIG_RT_GROUP_SCHED config*) I was able to extract this piece of logic
>
>
>
> *chrt -p 777*
> pid 777's current scheduling policy: SCHED_OTHER
> pid 777's current scheduling priority: 0
> *cat /proc/777/cgroup*
> 2:cpu,cpuacct:/system.slice
> 1:name=systemd:/system.slice/d.service
> *chrt -f -p 50 777*
>
> root at mgu-high:~# chrt -p 777
> pid 777's current scheduling policy: SCHED_FIFO
> pid 777's current scheduling priority: 50
> */bin/echo 777>/sys/fs/cgroup/cpu,cpuacct/interaction.slice/tasks**echo: write error: Invalid argument*
>
>
> After browsing kernel sources I was able to find out the reason of failure.
>
>
> static int cpu_cgroup_can_attach(struct cgroup_subsys_state *css,
> 				 struct cgroup_taskset *tset)
> {
> 	struct task_struct *task;
>
> 		
> 	cgroup_taskset_for_each(task, tset) {
> #ifdef CONFIG_RT_GROUP_SCHED
> 		if (!sched_rt_can_attach(css_tg(css), task))
> 			return -EINVAL;
> #else
> 		
>
>
>
> */* We don't support RT-tasks being in separate groups */		if (task->sched_class != &fair_sched_class)		{			return -EINVAL;		}*
> #endif
> 	}
> 	return 0;
> }
>
> My question is why is this check required? Also, changing cgroups first and then the policy of FIFO works without issue(?) for the task.
>
> Thanks
>
>
> br
>
> rb
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160920/e5388bf7/attachment-0001.html 

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

* Changing RT task to a different cgroup
  2016-09-20 12:39 ` Rahul Bhattacharya
@ 2016-09-20 13:09   ` Juan Luis De Sousa-Valadas Castano
  0 siblings, 0 replies; 3+ messages in thread
From: Juan Luis De Sousa-Valadas Castano @ 2016-09-20 13:09 UTC (permalink / raw)
  To: kernelnewbies

I would try the cgroups mailing list:

http://vger.kernel.org/vger-lists.html#cgroups

Juan.

On Tue, Sep 20, 2016 at 2:39 PM, Rahul Bhattacharya
<rahulimpdocs@gmail.com> wrote:
> Any idea or feedback for the person to contact?
> Thanks
>
> br
> rb
>
> On Wed, Sep 14, 2016 at 5:21 PM, Rahul Bhattacharya <rahulimpdocs@gmail.com>
> wrote:
>>
>> When I try to move a RT task to a different cgroup(shown below) I get a
>> EINVAL error.
>>
>> However I can change the cgroup first and then change the sched policy.
>>
>> After looking into kernel source code(I dont use CONFIG_RT_GROUP_SCHED
>> config) I was able to extract this piece of logic
>>
>>
>>
>> chrt -p 777
>> pid 777's current scheduling policy: SCHED_OTHER
>> pid 777's current scheduling priority: 0
>>
>> cat /proc/777/cgroup
>> 2:cpu,cpuacct:/system.slice
>> 1:name=systemd:/system.slice/d.service
>>
>> chrt -f -p 50 777
>>
>> root at mgu-high:~# chrt -p 777
>> pid 777's current scheduling policy: SCHED_FIFO
>> pid 777's current scheduling priority: 50
>>
>> /bin/echo 777>/sys/fs/cgroup/cpu,cpuacct/interaction.slice/tasks
>> echo: write error: Invalid argument
>>
>>
>>
>> After browsing kernel sources I was able to find out the reason of
>> failure.
>>
>>
>> static int cpu_cgroup_can_attach(struct cgroup_subsys_state *css,
>> 				 struct cgroup_taskset *tset)
>> {
>> 	struct task_struct *task;
>>
>> 		
>> 	cgroup_taskset_for_each(task, tset) {
>> #ifdef CONFIG_RT_GROUP_SCHED
>> 		if (!sched_rt_can_attach(css_tg(css), task))
>> 			return -EINVAL;
>> #else
>> 		/* We don't support RT-tasks being in separate groups */
>> 		if (task->sched_class != &fair_sched_class)
>> 		{
>> 			return -EINVAL;
>> 		}
>> #endif
>> 	}
>> 	return 0;
>> }
>>
>> My question is why is this check required? Also, changing cgroups first
>> and then the policy of FIFO works without issue(?) for the task.
>>
>> Thanks
>>
>>
>> br
>>
>> rb
>
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



-- 
Juan-Luis de Sousa-Valadas Casta?o
Iberia Infrastructure Consultant - Red Hat

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

end of thread, other threads:[~2016-09-20 13:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-14 15:21 Changing RT task to a different cgroup Rahul Bhattacharya
2016-09-20 12:39 ` Rahul Bhattacharya
2016-09-20 13:09   ` Juan Luis De Sousa-Valadas Castano

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.