[maemo-developers] Is it possible to use SCHED_FIFO policy on N900?

From: Eero Tamminen eero.tamminen at nokia.com
Date: Tue Apr 27 11:21:27 EEST 2010

ext tarantism wrote:
> On Mon, 2010-04-26 at 16:19 +0300, Eero Tamminen wrote:
>> ext tarantism wrote:
>>> _POSIX_PRIORITY_SCHEDULING is defined but attempting to create a pthread
>>> with SCHED_FIFO returns an error. Calling pthread_setschedparam with
>>> policy of SCHED_FIFO doesn't complain but checking with
>>> pthread_getschedparam shows a policy of SCHED_OTHER.
>>> Is it possible to set a policy of SCHED_FIFO (or SCHED_RR) or am I
>>> wasting my time?
>> Are you running as root?
> Thanks for the reply.
> Yes, I'm running as root.
> Code that works fine on Ubuntu returns an error from pthread_create.
> Can you confirm that SCHED_FIFO works on Fremantle? If it does, I'll
> happily keep plugging away but it would be nice to know that what I'm
> trying to do is possible!

There's a stress-test package that has a tool with options
for selecting the scheduler:

Changing the scheduler doesn't for some reason seem to work now:
# cpuload -s f 10

CPU load generator, build Sep  4 2009 15:09:38. 

Copyright (C) 2006,2008 Nokia Corporation. 


WARNING: setting scheduler failed failed: operating with default. 

Reason: Operation not permitted
# strace cpuload -s f 10 
sched_get_priority_max(SCHED_FIFO)      = 99 

sched_setscheduler(0, SCHED_FIFO, { 99 }) = -1 EPERM (Operation not 

But it definitely worked last summer when this option was added to it.
I'm not sure what's happened in the meanwhile.

Maybe the issues is with the used realtime priority:
# cat /proc/self/limits |grep realtime
Max realtime priority     0                    0 

Max realtime timeout      unlimited            unlimited            us

Does setting SCHED_FIFO with priority 0 work?

	- Eero
More information about the maemo-developers mailing list