lkml.org 
[lkml]   [2003]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: POLLRDONCE optimisation for epoll users (was: epoll and half closed TCP connections)
On Mon, 14 Jul 2003, Jamie Lokier wrote:

> Jamie Lokier wrote:
> > Anyway, there is a correct answer and I have made the patch so wait
> > for next mail... :)
>
> The patch is included below. Note, it compiles and has been carefully
> scrutinised by a team of master coders, but never actually run. Eric,
> you may want to try it out :)
>
> The difference between this and POLLRDHUP is polarity, generality and
> correctness :)
>
> Eric, change the polarity of your test from
>
> if (events & POLLRDHUP)
> goto read_again;
>
> to
>
> if (!(events & POLLRDONCE))
> goto read_again;
>
> and it should (fingers crossed) work well.

Ouch, I definitely liked more the POLLHUP thing. It is not linked to epoll
at all. Ok, suppose that our super-fast app choses Edge Triggered epoll
and also, aiming at topp speeds, using the smart read(2) trick :


void my_process_read(my_data *d, unsigned int events) {
int n, s;
do {
s = d->buffer_size - d->in_buffer;
if ((n = read(d->fd, d->buffer + d->in_buffer, s)) > 0) {
process_partial_buffer(d, s);
d->in_buffer += s;
}
} while (n == s);
if (s == -1 && errno != EAGAIN) {
handle_read_error(d);
return;
}
if (events & EPOLLRDHUP) {
d->flags |= HANGUP;
schedule_removal(d);
}
}
Where this will break by using a POLLRDHUP ?



- Davide

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:46    [W:0.280 / U:0.932 seconds]
©2003-2014 Jasper Spaans. Advertise on this site