[tor-bugs] #24448 [Core Tor/Tor]: Channeltls adds the connection write event to main loop when writing a packed cell
Tor Bug Tracker & Wiki
blackhole at torproject.org
Mon Nov 27 21:42:52 UTC 2017
#24448: Channeltls adds the connection write event to main loop when writing a
packed cell
------------------------------+--------------------------------
Reporter: dgoulet | Owner: (none)
Type: defect | Status: new
Priority: Medium | Milestone: Tor: 0.3.3.x-final
Component: Core Tor/Tor | Version:
Severity: Normal | Keywords: tor-sched
Actual Points: | Parent ID: #23993
Points: | Reviewer:
Sponsor: |
------------------------------+--------------------------------
This is another problem in the line of channel subsystem and KIST. It is a
difficult problem because tor is wired to use libevent connection's write
and read event where KIST needs to control what is put on the network at
what time.
So, here is the callstack that leads to the channeltls layer adding the
`conn->write_event` to the main loop:
{{{
channel_tls_write_packed_cell_method()
-> connection_buf_add()
-> connection_write_to_buf_commit()
-> connection_start_writing()
-> event_add(conn->write_event, NULL)
}}}
Basically, when we flush cell(s) from a circuit, we do call back into the
channel subsystem to write the packed cell (only packed cell on a circuit
queue). The libevent write event is then added to the main loop. Then KIST
scheduler kicks in a tick later (10 ms) and can also try to write.
I don't see a direct impact here but we could avoid an entire
"write_event" callback on a connection with the KIST scheduler which seems
to me like a good optimization especially on fast relays.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/24448>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list