Re: Preemptive linux



Will this challenge the driver developer, such as reentrant function
handling.

Any comments?

ABAI
David Schwartz wrote:
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

  • Re: Preemptive linux
    ... Alexander Krizhanovsky wrote: ... preemtible for opportunity to switch context. ... int sys_foo ... preemption also must be enabled by preempt_enable. ...
    (comp.os.linux.development.system)
  • Re: Preemptive linux
    ... David Schwartz wrote: ... preemption might be disabled and you still want to be able to be ... AFAIK, just for SMP systems thread can be marked by TIF_NEED_RESCHED ...
    (comp.os.linux.development.system)