Re: Preemptive linux



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().

.



Relevant Pages

  • [patch] PPC debug setcontext syscall implementation.
    ... A syscall has been reserved for a debug setcontext for PPC, ... Add a debugging interface for PowerPC that allows signal handlers (or any ... volatile int called2 = 0; ...
    (Linux-Kernel)
  • Re: Linux Syscalls, POSIX Functions and other generic Library Functions.
    ... And as said, linux manpages are not always to be trusted, nor might they be consistent - many are written by different people... ... int, prot, int, flags, int, fd, off_t, pgoffset) ... I think that it clearly states that in order to call the mmap2syscall ... int mprotect(const void *addr, size_t len, int prot); ...
    (comp.os.linux.development.apps)
  • Re: Finding hardlinks
    ... the best solution for these filesystems would be either to add new syscall ... int is_hardlink ... NFS has exactly the same problem ... determine that two filesystem objects are hard linked if they have the same ...
    (Linux-Kernel)
  • Re: [PATCH] Added PR_SET_PROCTITLE_AREA option for prctl()
    ... I was hoping to use the syscall only once per process. ... err = prctl+1); ... int res = 0; ... len = strnlen(buffer, res); ...
    (Linux-Kernel)
  • Re: Linux Syscalls, POSIX Functions and other generic Library Functions.
    ... second has an EAGAIN that is not present in the first one. ... Is the syscall invoked, perhaps through a C library wrapper ... int, prot, int, flags, int, fd, off_t, pgoffset) ... int mprotect(const void *addr, size_t len, int prot); ...
    (comp.os.linux.development.apps)