Re: tasklets vs. workqueues

From: Martin Diehl
Date: Wed Feb 25 2004 - 16:14:41 EST


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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/