Operation not permitted by using sched_setscheduler

I have a errno:1(Operation not permitted) if sched_setscheduler.
Could you please teach me how to modify?


Sample code)
int nRetval;
struct sched_param schedParam;

schedParam.sched_priority = 40;
nRetval = sched_setscheduler( 0, SCHED_FIFO, &schedParam );
if (nRetval == -1)
{
printf(“errno(%d) : %s\n”, errno, strerror(errno));
}

Development

  • Jetson TX2
  • Jetpack 3.3 (R28.2.1)

Issue
Error happen if I used sched_setscheduler.
Of course, I used “sudo” for running the program.

Reason
errno : 1 (Operation not permitted)

Question
How do I used sched_setscheduler on Jetpack 3.3?

Additional Info.
I could use sched_setscheduler without error on Jetpack 3.1

I hate to try to answer this because there is a lot I don’t know, but have you worked with cgroups before? Assuming there is a possibility of using sched_setscheduler, then the task you are working on must be correctly categorized. See these on cgroups:
https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt
https://en.wikipedia.org/wiki/Cgroups

Thank you for giving me good advice.

I check cgroup and found the reason of this issue, following value is set 0.
/ sys/fs/cgroup/cpu/user.slice/cpu.rt_runtime_us

seched_setschduler works correctly if cpu.ru_runtime_us = 950000.

I appreciate your kind response.