All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul P <ppak_98@yahoo.com>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: unexpected extra pollout events from epoll
Date: Sun, 26 Oct 2008 15:48:45 -0700 (PDT)	[thread overview]
Message-ID: <99943.65323.qm@web56305.mail.re3.yahoo.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0810261452221.19212@alien.or.mcafeemobile.com>

> After that, via epoll_wait(), f_op->poll() is called to get the status of  the file, and since POLLIN|POLLOUT is returned (and since you're listening for EPOLLIN|EPOLLOUT), that gets reported back to you. The POLLOUT event, by meaning a buffer-full->buffer-avail transition, did not really happen, but since POLLOUT is true, that gets reported back too.

Ok, so make sure I understand you correctly, you're saying that currently the kernel doesn't have awareness of the difference between EPOLLIN and EPOLLOUT events because at the time of the event, both EPOLLIN/EPOLLOUT are returned from the kernel and that at least for the near term that's not going to change.  At some point, we can expect the EPOLLOUT to give the correct event, but not till later than .28.

> The best way to do it ATM, is to wait for POLLOUT only when
> really needed.

I'm a little unclear how to do this.  If I set the epoll_wait call to wait for just epollin events, that's fine.  But when I send a large buffer of data and use epoll_ctl to look for epollin|epollout events, don't I have the same problem?  

Let's say I'm sending a large buffer of data and I arm the fd to epollin|epollout (I'm adding an epollin flag because a message could come in while I'm sending)

If an event gets triggered on an fd, then I have no way of knowing if the event is from the socket being available to send data or if there is data waiting to be received since the epollin|epollout flag could be either one.  So what am I to do when I get an event?

Are you saying that I can't do sending and receiving simultaneously with epoll?  If that's the case, then is everyone simply setting the epollout flag when sending and ignoring the possibility of data coming in while data is being sent?

I didn't want to have to manually set fd's with epoll_ctl, but now I guess the epoll_one_shot flag makes more sense.  

Paul


      

  reply	other threads:[~2008-10-26 22:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-26 14:42 unexpected extra pollout events from epoll Paul P
2008-10-26 22:07 ` Davide Libenzi
2008-10-26 22:48   ` Paul P [this message]
2008-10-26 23:12     ` Davide Libenzi
     [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-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.iE6LeMsZ2b+Y7nnAUJEFSvwEiiU@ifi.uio.no>
     [not found] ` <fa.KeDEgbYh8k5LzzH6uv7u00N5twU@ifi.uio.no>
2008-10-27  5:59   ` Robert Hancock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99943.65323.qm@web56305.mail.re3.yahoo.com \
    --to=ppak_98@yahoo.com \
    --cc=davidel@xmailserver.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.