Re: poll_wait() again

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 30, 2002 at 12:21:28PM +0800, zw wrote:
> I seem to understand, but I don't.
> 
> In the case of tcp_poll(). From sys_poll() all the way down to just 
> before the call to tcp_poll() through a file pointer, kernel setup 
> the poll_wqueue all well. And then just as soon as the entering of 
> tcp_poll(), it calls poll_wait() to wakeup the queue. What's the 
> point? It hasn't done anything real just yet.
> 
> Ie., first setup a wait_queue, then wakeup the queue, then to do the 
> real work. What's the point of the wait_queue?

IIRC poll_wait is not a wake-up at all. It ends in add_wait_queue (I am
looking at 2.4.19, but I don't think poll logic changed that much).

IIRC the poll logic goes as follows: sys_poll calls ->poll method on all
descriptors. These call poll_wait to set up wait queues and then check
the current state. If all ->poll methods return 0, sys_poll schedule()s
and goes to call the methods again. If some return nonzero or time is
up, it discards the queues and returns.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux