Re: Preemptive linux




Alexander Krizhanovsky wrote:
AFAIK, you need call preempt_check_resched() for make your syscall
preemtible for opportunity to switch context. So your code should be
like following:

int sys_foo(void)
{
while (1)
preempt_check_resched();
return 0;
}

Also you need to set TIF_NEED_RESCHED flag for this thread if it should
be rescheduled and when this thread call preempt_check_resched() in
next time it will be rescheduled.

Of course, preemption also must be enabled by preempt_enable().

As I understand it, so long as you properly select preemption when you
build the kernel, it should be enabled by default and no special calls
should be needed. You only need to call 'preempt_check_resched' if
preemption might be disabled and you still want to be able to be
preempted at a particular point.

I am not 100% sure, but this is my understanding of the code and the
documentation.

DS

.



Relevant Pages