Re: Real time application programming - sched_setattr() fails if I set CPU affinity using sched_setaffinity().

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Bhargav,

On 20/11/17 10:09, bhargavb wrote:
> Hello,
> 
> Working on a real time application, Getting runtime error at
> sched_setattr as "Operation Not permitted".Running on Ubuntu 16.04 LTS
> (4.4.0-97-generic kernel, x86_64 platform)
> C program code excerpt as below:
> 
> unsigned int flags = 0;
> sched_getattr(0, &attr, sizeof (struct sched_attr), 0);
> if (ret != 0)
> perror("getattr failed:");
> attr.sched_policy = SCHED_DEADLINE;
> attr.sched_runtime = 5 * 100 * 1000;
> attr.sched_deadline = 8 * 100 * 1000;
> attr.sched_period = 10 * 100 * 1000;
> attr.size = sizeof (attr);
> attr.sched_flags = 0;
> attr.sched_nice = 0;
> attr.sched_priority = 0;
> 
> if(sched_setaffinity(0,sizeof(set), &set) < 0)
> {
> perror("sched_setaffinity :");
> return 0;
> }
> ret = sched_setattr(0, &attr, flags);
> if(ret!=0)
> {
> perror("sched_setattr failed: ");
> }
> 
> But, If I comment the sched_setaffinity() call, it runs without error.
> Also, using SCHED_FIFO by calling sched_setscheduler() doesn't give me
> any error after setting CPU affinity. Only the combination of
> sched_setaffinity with sched_setattr() generates error. I am running
> in sudo mode.

Problem is that SCHED_DEADLINE tasks can't have an affinity mask smaller than
the root domain they are on [1]. You've got to use cpuset to achieve what you
want.

Best,

Juri

[1] https://elixir.free-electrons.com/linux/latest/source/Documentation/scheduler/sched-deadline.txt#L620
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux