Il 24/07/2013 09:43, liu ping fan ha scritto: > Paid some time to dig the kernel code, and find out that the > resolution lost by timeout of poll/select..etc is cause by the timeout > is a slack region. > See code in > do_poll() > if (!poll_schedule_timeout(wait, TASK_INTERRUPTIBLE, to, slack)) > > Notice the slack param, it causes the lose of resolution. > The process default slack time inherits from init_task and it is > .timer_slack_ns = 50000, /* 50 usec default slack */ > But we can fix it by PR_SET_TIMERSLACK to decrease it for select/poll/...
Right, good catch. I just learnt about PR_SET_TIMERSLACK. :) Alex, can you add it to your series? (Note that you must set a timer slack of 1, because 0 is interpreted as "default"). > So ppoll with timerslack adjustment will meet our requirement. But > what about other non-linux system? They might have their own mechanism similar to PR_SET_TIMERSLACK. Paolo