public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: unexpected extra pollout events from epoll
@ 2008-10-27  0:58 Paul P
  2008-10-27  1:18 ` Davide Libenzi
  0 siblings, 1 reply; 10+ messages in thread
From: Paul P @ 2008-10-27  0:58 UTC (permalink / raw)
  To: linux-kernel

> You do that by writing data until it's finished, or you
> get EAGAIN. If you
> get EAGAIN, you listen for EPOLLOUT.
> Reading is same, but you'd wait for EPOLLIN.

I've got a few questions about this approach.  The most logical 
way to do this seems to be:

1) Leave the epoll_wait with the EPOLLIN|EPOLLOUT event flags and
 use epoll_ctl to switch the interest mask for each fd between EPOLLIN 
and EPOLLOUT on a per fd basis.

2) When I'm ready to write, I do a write and if it does not fully 
write and I get the EAGAIN flag, I switch the fd with epoll_ctl(fd,MOD,EPOLLOUT). 

However, I get strange behavior when I tried adding fd's with only the 
EPOLLIN interest mask. If I use epoll_wait with both the EPOLLIN and 
EPOLLOUT interest mask, but add fd's with only the EPOLLIN interest mask,
I still seem to get EPOLLOUT events on the fd.

Am I supposed to change the main loop with epoll_wait so that when one 
socket is reading that I switch the main loop to get EPOLLOUT events?  
That means that I'm not receiving on any fd while I'm sending, so this 
probably isn't right.

So, I'm a little confused.

Thanks in advance.

Paul



      

^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <fa.YTdIGxaBsWvyaUnxBGIS1f8F2BM@ifi.uio.no>]
* unexpected extra pollout events from epoll
@ 2008-10-26 14:42 Paul P
  2008-10-26 22:07 ` Davide Libenzi
  0 siblings, 1 reply; 10+ messages in thread
From: Paul P @ 2008-10-26 14:42 UTC (permalink / raw)
  To: linux-kernel

I am programming a server using the epoll interface and have the receive portion of the server working fine, but for some reason as I implement the send portion, I noticed a few things that seem like strange behaviors in the implementation of epoll in the kernel.

I'm running Opensuse 11 and it has a 2.6.25 kernel.

The behavior that I can seeing is when I do a full read on an edge triggered fd, for some reason, it seems to be triggering an epollout event after each loop of the read events on a socket. (before I've done any writes at all to the socket)

This is very strange behavior as I would expect that the epollout event would only be triggered if I did a write and the socket recieved an ack which cleared out the send buffer.

The documentation on epollout is really sparse, so any help at all from the list would be very much appreciated.  Do I need to manually arm the epollout flag after a write?  I thought this was only necessary for level triggered epoll.

I was hoping someone more knowledgeable on the subject here might be able to help explain the epollout behavior and whether or not the extra events are normal and if so, what is the traditional way to handle these extra events in an edge triggered scenario.

Thanks!

Paul


      

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-10-27  5:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <fa.iE6LeMsZ2b+Y7nnAUJEFSvwEiiU@ifi.uio.no>
     [not found] ` <fa.KeDEgbYh8k5LzzH6uv7u00N5twU@ifi.uio.no>
2008-10-27  5:59   ` unexpected extra pollout events from epoll Robert Hancock
2008-10-27  0:58 Paul P
2008-10-27  1:18 ` Davide Libenzi
2008-10-27  1:23   ` Davide Libenzi
2008-10-27  3:48   ` Paul P
     [not found] <fa.YTdIGxaBsWvyaUnxBGIS1f8F2BM@ifi.uio.no>
2008-10-26 16:43 ` Robert Hancock
  -- strict thread matches above, loose matches on Subject: below --
2008-10-26 14:42 Paul P
2008-10-26 22:07 ` Davide Libenzi
2008-10-26 22:48   ` Paul P
2008-10-26 23:12     ` Davide Libenzi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox