-
Notifications
You must be signed in to change notification settings - Fork 4k
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
epoll bthread deal first #2819
base: master
Are you sure you want to change the base?
epoll bthread deal first #2819
Changes from 7 commits
c8531be
0b18def
95e5b84
76cbfa3
56276a2
01aba4d
708725a
d10137c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
#include <vector> | ||
#include <array> | ||
#include <memory> | ||
#include <unordered_map> | ||
#include "butil/atomicops.h" // butil::atomic | ||
#include "bvar/bvar.h" // bvar::PassiveStatus | ||
#include "bthread/task_tracer.h" | ||
|
@@ -96,6 +97,12 @@ friend bthread_t init_for_pthread_stack_trace(); | |
void stack_trace(std::ostream& os, bthread_t tid); | ||
std::string stack_trace(bthread_t tid); | ||
#endif // BRPC_BTHREAD_TRACER | ||
// Only deal once when init epoll bthread. | ||
void set_group_epoll_tid(bthread_tag_t tag, bthread_t tid); | ||
|
||
void push_priority_q(bthread_tag_t tag, bthread_t tid) { | ||
_priority_qs[tag].push(tid); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 如果_priority_qs扩容了,是不是会有问题? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. _priority_qs 目前其实不会扩容,因为 epoll 的 tid 数量在启动的时候就决定了,而且使用的是 workStealQueue,这个应该是线程安全的吧 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这一块需要修改的话,可以rebase一下。#2916 修复了一个导致UT经常失败的bug。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
这里我 reserve 一下,应该是不用校验的,我看过链路了,在这个之前其他地方应该都校验过很多次了 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
private: | ||
typedef std::array<TaskGroup*, BTHREAD_MAX_CONCURRENCY> TaggedGroups; | ||
|
@@ -153,13 +160,13 @@ friend bthread_t init_for_pthread_stack_trace(); | |
std::vector<bvar::PassiveStatus<double>*> _tagged_cumulated_worker_time; | ||
std::vector<bvar::PerSecond<bvar::PassiveStatus<double>>*> _tagged_worker_usage_second; | ||
std::vector<bvar::Adder<int64_t>*> _tagged_nbthreads; | ||
std::vector<WorkStealingQueue<bthread_t>> _priority_qs; | ||
|
||
std::vector<TaggedParkingLot> _pl; | ||
|
||
#ifdef BRPC_BTHREAD_TRACER | ||
TaskTracer _task_tracer; | ||
#endif // BRPC_BTHREAD_TRACER | ||
|
||
}; | ||
|
||
inline bvar::LatencyRecorder& TaskControl::exposed_pending_time() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里应该是 g_edisp[i * FLAGS_event_dispatcher_num + j] 吧?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的,我本地二次修改的时候没提交上来