Skip to content
Merged
Changes from all commits
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
11 changes: 0 additions & 11 deletions be/src/runtime/thread_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,19 +249,8 @@ static void attach_bthread() {
#endif
// Create thread-local data on demand.
bthread_context = new ThreadContext;
std::shared_ptr<MemTrackerLimiter> btls_tracker =
std::make_shared<MemTrackerLimiter>(-1, "Bthread:id=" + std::to_string(bthread_id),
ExecEnv::GetInstance()->bthread_mem_tracker());
bthread_context->attach_task(ThreadContext::TaskType::BRPC, "", TUniqueId(), btls_tracker);
// set the data so that next time bthread_getspecific in the thread returns the data.
CHECK_EQ(0, bthread_setspecific(btls_key, bthread_context));
} else {
// two scenarios:
// 1. A new bthread starts, but get a reuses btls.
// 2. A pthread switch occurs. Because the pthread switch cannot be accurately identified at the moment.
// So tracker call reset 0 like reuses btls.
DCHECK(bthread_context->_thread_mem_tracker_mgr->get_attach_layers() == 2);
bthread_context->_thread_mem_tracker_mgr->limiter_mem_tracker_raw()->reset_zero();
}
}

Expand Down