Skip to content

Add source location to task and tasktrace object #2707

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/seastar/core/task.hh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#ifndef SEASTAR_MODULE
#include <utility>
#include <source_location>
#endif

namespace seastar {
Expand All @@ -35,6 +36,8 @@ class task {
protected:
scheduling_group _sg;
private:
std::source_location resume_point = {};

Copy link
Member

Choose a reason for hiding this comment

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

This is making a very heavily used object larger.

Copy link
Author

Choose a reason for hiding this comment

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

After adding std::source_location

coroutine_traits_base<>::promise_type (which inherits from task) is 64 bytes,
continuation<Promise, Func, Wrapper, T> is around 104-120, depending on exact version.

No difference except for that single unlucky value, who is "promoted" to the next 64 byte cache line in case of continuation.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's okay.

#ifdef SEASTAR_TASK_BACKTRACE
shared_backtrace _bt;
#endif
Expand All @@ -53,6 +56,8 @@ public:
virtual void run_and_dispose() noexcept = 0;
/// Returns the next task which is waiting for this task to complete execution, or nullptr.
virtual task* waiting_task() noexcept = 0;
void update_resume_point(std::source_location sl) { resume_point = sl; }
auto get_resume_point() const { return resume_point; }
scheduling_group group() const { return _sg; }
shared_backtrace get_backtrace() const;
#ifdef SEASTAR_TASK_BACKTRACE
Expand Down