mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-20 05:56:54 +00:00
MINOR: fd: delete unused updates on close()
After a poller's ->clo() was called to completely terminate operations on an FD, there's no reason for keeping updates on this FD, so if any updates were already programmed it would be nice if we could delete them. Tests show that __fd_clo() is called roughly half of the time with the last FD from the local update list, which possibly makes sense if a close has to appear after a polling change resulting from an incomplete read or the end of a send(). We can detect this and remove the last entry, which gives less work to do during the update() call, and eliminates most of the poll_drop_fd event reports. Note that while tempting, this must not be backported because it's only safe to be done now that fd_delete_orphan() clears the update mask as we need to be certain not to miss it: - if the update mask is kept up with no entry, we can miss future updates ; - if the update mask is cleared too fast, it may result in failure to add a shared event.
This commit is contained in:
parent
35ee710ece
commit
8e2c0fa8e5
2
src/fd.c
2
src/fd.c
@ -322,6 +322,8 @@ void _fd_delete_orphan(int fd)
|
||||
|
||||
/* no more updates on this FD are relevant anymore */
|
||||
HA_ATOMIC_STORE(&fdtab[fd].update_mask, 0);
|
||||
if (fd_nbupdt > 0 && fd_updt[fd_nbupdt - 1] == fd)
|
||||
fd_nbupdt--;
|
||||
|
||||
port_range_release_port(fdinfo[fd].port_range, fdinfo[fd].local_port);
|
||||
polled_mask[fd].poll_recv = polled_mask[fd].poll_send = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user