How to wake_up the wait_queue of a socket?
hi: When one datagram has reached , How to wake_up the wait_queue of that socket ? Thanks!
On Mon, 14 Jan 2013 17:50:03 +0800, horseriver said:
When one datagram has reached , How to wake_up the wait_queue of that socket ?
Please clarify your question - I'm not sure which of the following you mean: 1) How does the kernel wake up the waiting process when a datagram arrives? 2) My kernel is failing to wake up the process, how do I fix it? 3) The kernel is waking the process up, but with high latency and I want to speed it up. 4) I'm trying to wake up a process for some reason when a datagram arrives (in which case, you're probably doing something wrong and we need to discuss what you're trying to achieve) Let us know in more detail what you wanted to know....
On Tue, Jan 15, 2013 at 12:25:10PM -0500, Valdis.Kletnieks@vt.edu wrote:
On Mon, 14 Jan 2013 17:50:03 +0800, horseriver said:
When one datagram has reached , How to wake_up the wait_queue of that socket ?
Please clarify your question - I'm not sure which of the following you mean:
1) How does the kernel wake up the waiting process when a datagram arrives? This is my mean ! Thanks
essentially, when the packet arrive, it will be assigned to the correct process based on IP address + port matching, and then the corresponding process's blocked scheduling status will be changed to continue execution, so that when the scheduler next selection of runnable process will pick him out for continue execution. The process will then pick his data up from the network queue. hope I have not made any mistake in my logic? On Tue, Jan 15, 2013 at 8:36 AM, horseriver <horserivers@gmail.com> wrote:
On Tue, Jan 15, 2013 at 12:25:10PM -0500, Valdis.Kletnieks@vt.edu wrote:
On Mon, 14 Jan 2013 17:50:03 +0800, horseriver said:
When one datagram has reached , How to wake_up the wait_queue of that socket ?
Please clarify your question - I'm not sure which of the following you mean:
1) How does the kernel wake up the waiting process when a datagram arrives?
This is my mean !
Thanks
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Regards, Peter Teoh
On Fri, Jan 18, 2013 at 10:18:19AM +0800, Peter Teoh wrote:
essentially, when the packet arrive, it will be assigned to the correct process based on IP address + port matching, and then the corresponding process's blocked scheduling status will be changed to continue execution, so that when the scheduler next selection of runnable process will pick him out for continue execution. The process will then pick his data up from the network queue.
Thanks! If there is no event occured on one socket descriptor , will the poll operation on this socket descriptor be blocked ?
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Regards, Peter Teoh
On Sat, Jan 19, 2013 at 1:36 AM, horseriver <horserivers@gmail.com> wrote:
On Fri, Jan 18, 2013 at 10:18:19AM +0800, Peter Teoh wrote:
essentially, when the packet arrive, it will be assigned to the correct process based on IP address + port matching, and then the corresponding process's blocked scheduling status will be changed to continue execution, so that when the scheduler next selection of runnable process will pick him out for continue execution. The process will then pick his data up from the network queue.
Thanks!
If there is no event occured on one socket descriptor , will the poll operation on this socket descriptor be blocked ?
I/O mechanism have two types: blocking and non-blocking. by definition: poll is non-blocking, and select() is blocking. In general that is true for kernel source as well. For details and implementations there may be ambiguity. For eg, manpage say poll may has a timeout for blocking, and inside the kernel source: in fs/select.c's definition for select() syscall: SYSCALL_DEFINE5(select, int, n, fd_set __user *, inp, fd_set __user *, outp, fd_set __user *, exp, struct timeval __user *, tvp) { struct timespec end_time, *to = NULL; struct timeval tv; int ret; if (tvp) { if (copy_from_user(&tv, tvp, sizeof(tv))) return -EFAULT; to = &end_time; if (poll_select_set_timeout(to, tv.tv_sec + (tv.tv_usec / USEC_PER_SEC), (tv.tv_usec % USEC_PER_SEC) * NSEC_PER_USEC)) return -EINVAL; } ret = core_sys_select(n, inp, outp, exp, to); ret = poll_select_copy_remaining(&end_time, tvp, 1, ret); And for syscall of poll() (same file): SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, unsigned int, nfds, long, timeout_msecs) { struct timespec end_time, *to = NULL; int ret; if (timeout_msecs >= 0) { to = &end_time; poll_select_set_timeout(to, timeout_msecs / MSEC_PER_SEC, NSEC_PER_MSEC * (timeout_msecs % MSEC_PER_SEC)); } So there is this common file poll_select_set_timeout() called by both....the details is even more confusing - shall stop here. A good article on epoll etc: http://www.eecs.berkeley.edu/~sangjin/2012/12/21/epoll-vs-kqueue.html
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Regards, Peter Teoh
-- Regards, Peter Teoh
participants (3)
-
horseriver -
Peter Teoh -
Valdis.Kletnieks@vt.edu