Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcp: Explain why tcp::poll_tcb() does not use coroutines #2544

Closed
wants to merge 1 commit into from

Conversation

p12tic
Copy link
Contributor

@p12tic p12tic commented Nov 21, 2024

This will prevent PRs like #2543 in the future.

cc @avikivity

@@ -815,6 +815,8 @@ tcp<InetTraits>::tcp(inet_type& inet)

template <typename InetTraits>
future<> tcp<InetTraits>::poll_tcb(ipaddr to, lw_shared_ptr<tcb> tcb) {
// Note that get_l2_dst_address() returns a ready future most of the time, so
// chaining a callback is mostly free.
return _inet.get_l2_dst_address(to).then([this, tcb = std::move(tcb)] (ethernet_address dst) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are hundreds of call sites where this holds. I don't think they all merit such annotation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've seen in the past (I guess more in the ScyllaDB project than in Seastar itself) people randomly "cleaning up" working continuation-based code to use coroutines, so maybe if some place thoughtfully used continuations instead of couroutines because of a performance benefit and this code is performance-critical (so performance is more important than elegance), then maybe a comment would be helpful. I don't know if this specific function is an example of this.

Obviously, if someone was working on the Seastar tutorial, it is important to discuss there the cases where continuations perform better than coroutines - and the opposite cases where coroutines perform better than continuations.

@p12tic p12tic closed this Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants