]> git.ipfire.org Git - thirdparty/squid.git/commit
Optimization: Fewer epoll(2) system calls when closing a socket (#235)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Fri, 6 Jul 2018 04:08:37 +0000 (04:08 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Sun, 15 Jul 2018 06:28:25 +0000 (18:28 +1200)
commite1db46616b784eb9caa76f6bfe0009513f2655a6
treeeaf827c7b92e4e12fec95a30b77b412c52e7be05
parent88d31e75393cc0e9721d1bbf057510b759918227
Optimization: Fewer epoll(2) system calls when closing a socket (#235)

Squid was calling epoll(2) twice to clear a socket interest. One call is
more than enough: Technically, close(2) is supposed to clear epoll(2)
registration for us, but I did not risk relying on that.

In other environments, socket interest changes are pooled together
before being submitted to the OS, so Squid was doing a bit of extra
work, but not making (many) extra system calls AFAICT.

Also fixed (previously unused) Comm::ResetSelect() on these platforms:
* epoll(2): The old resetting code did not clear our interest AFAICT.
* kqueue(2): The old resetting code made no sense to me at all.
* poll(2): There was no code at all.
* select(Win32): There was no code at all.

Even though Comm::ResetSelect() implementation is now the same for all
platforms, I did not make that code platform-agnostic because it is
possible to optimize it further in platform-specific ways.
src/client_side.cc
src/comm/Loops.h
src/comm/ModDevPoll.cc
src/comm/ModEpoll.cc
src/comm/ModKqueue.cc
src/comm/ModPoll.cc
src/comm/ModSelect.cc
src/comm/ModSelectWin32.cc
src/fd.cc
src/tests/stub_libcomm.cc