[OPTIM] sepoll: do not re-check whole list upon accepts

There is already an optimisation in the speculative poller which
causes newly created FDs to be checked immediately after being
created. Unfortunately, this optimisation causes the whole spec
list to be re-checked while we're only interested in the new FDs.

Doing this minor change causes performance gains of up to 6% on
medium-sized objects with a few hundreds concurrent connections.
This commit is contained in:
Willy Tarreau 2009-03-22 19:25:46 +01:00
parent b00f9c456c
commit 573fd806ed

View File

@ -243,7 +243,7 @@ REGPRM2 static int __fd_set(const int fd, int dir)
if (i == FD_EV_IDLE) {
// switch to SPEC state and allocate a SPEC entry.
fd_created = 1;
fd_created++;
alloc_spec_entry(fd);
switch_state:
fd_list[fd].e ^= (unsigned int)(FD_EV_IN_SL << dir);
@ -335,6 +335,10 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
fd = spec_list[spec_idx];
eo = fd_list[fd].e; /* save old events */
if (looping && --fd_created < 0) {
/* we were just checking the newly created FDs */
break;
}
/*
* Process the speculative events.
*
@ -535,7 +539,6 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
* if we fail, the tasks are still woken up, and the FD gets marked
* for poll mode.
*/
fd_created = 0;
looping = 1;
goto re_poll_once;
}