* How to wake_up the wait_queue of a socket?
@ 2013-01-14 9:50 horseriver
2013-01-15 17:25 ` Valdis.Kletnieks at vt.edu
0 siblings, 1 reply; 6+ messages in thread
From: horseriver @ 2013-01-14 9:50 UTC (permalink / raw)
To: kernelnewbies
hi:
When one datagram has reached , How to wake_up the wait_queue of that socket ?
Thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
* How to wake_up the wait_queue of a socket?
2013-01-15 17:25 ` Valdis.Kletnieks at vt.edu
@ 2013-01-15 0:36 ` horseriver
2013-01-18 2:18 ` Peter Teoh
0 siblings, 1 reply; 6+ messages in thread
From: horseriver @ 2013-01-15 0:36 UTC (permalink / raw)
To: kernelnewbies
On Tue, Jan 15, 2013 at 12:25:10PM -0500, Valdis.Kletnieks at 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* How to wake_up the wait_queue of a socket?
2013-01-14 9:50 How to wake_up the wait_queue of a socket? horseriver
@ 2013-01-15 17:25 ` Valdis.Kletnieks at vt.edu
2013-01-15 0:36 ` horseriver
0 siblings, 1 reply; 6+ messages in thread
From: Valdis.Kletnieks at vt.edu @ 2013-01-15 17:25 UTC (permalink / raw)
To: kernelnewbies
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....
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130115/227db625/attachment.bin
^ permalink raw reply [flat|nested] 6+ messages in thread
* How to wake_up the wait_queue of a socket?
2013-01-15 0:36 ` horseriver
@ 2013-01-18 2:18 ` Peter Teoh
2013-01-18 17:36 ` horseriver
0 siblings, 1 reply; 6+ messages in thread
From: Peter Teoh @ 2013-01-18 2:18 UTC (permalink / raw)
To: kernelnewbies
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 at 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 at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
--
Regards,
Peter Teoh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130118/f7d51275/attachment.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* How to wake_up the wait_queue of a socket?
2013-01-18 2:18 ` Peter Teoh
@ 2013-01-18 17:36 ` horseriver
2013-01-19 5:18 ` Peter Teoh
0 siblings, 1 reply; 6+ messages in thread
From: horseriver @ 2013-01-18 17:36 UTC (permalink / raw)
To: kernelnewbies
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 at kernelnewbies.org
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
>
>
>
> --
> Regards,
> Peter Teoh
^ permalink raw reply [flat|nested] 6+ messages in thread
* How to wake_up the wait_queue of a socket?
2013-01-18 17:36 ` horseriver
@ 2013-01-19 5:18 ` Peter Teoh
0 siblings, 0 replies; 6+ messages in thread
From: Peter Teoh @ 2013-01-19 5:18 UTC (permalink / raw)
To: kernelnewbies
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 at kernelnewbies.org
> > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> > >
> >
> >
> >
> > --
> > Regards,
> > Peter Teoh
>
--
Regards,
Peter Teoh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130119/04a27719/attachment.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-01-19 5:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-14 9:50 How to wake_up the wait_queue of a socket? horseriver
2013-01-15 17:25 ` Valdis.Kletnieks at vt.edu
2013-01-15 0:36 ` horseriver
2013-01-18 2:18 ` Peter Teoh
2013-01-18 17:36 ` horseriver
2013-01-19 5:18 ` Peter Teoh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).