On Wed, 25 Feb 2004, George Anzinger wrote:
Being in process context, you can also change the priority and schedule policy as needed to fit your application, while you are rather stuck with tasklets in this regard.
How would one do that correctly? Something like
Depends on where you want to be when you do it. From user land you would do exactly what the attached program does. In SMP you would, likely, want to do all the tasks in the work queue (one per cpu).
Ok, thanks - primary concern was kernelthread anyway. Sorry if I wasn't clear enough.
From the kernel, again calling setscheduler() is the way to go. I am not sure what is in the community tree just now, but if I recall properly, the scheduler itself does this so, one should be able to copy that code.
Ah, yes, there it is in migration_thread(). It calls setscheduler().
Basically yes. Except that setscheduler is static in kernel/sched.c so one has to use sys_sched_setscheduler (and add some EXPORT_SYMBOL for it). And of course it needs the set_fs(KERNEL_DS) magic.
Thanks, I was hoping I've missed some simple "official" entry point there to create a SCHED_FIFO kernel thread from a module.
Martin