Skip to content

Commit 4d8b0e4

Browse files
authored
Merge pull request #3 from MalikHou/malikhou/add_edisp_unsched
fix
2 parents 95e13d0 + 9218d96 commit 4d8b0e4

3 files changed

Lines changed: 12 additions & 41 deletions

File tree

docs/cn/rdma.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,17 @@ RDMA是硬件相关的通信技术,有很多独特的概念,比如device、p
5050
RDMA支持事件驱动和轮询两种模式,默认是事件驱动模式,通过设置rdma_use_polling可以开启轮询模式。轮询模式下还可以设置轮询器数目(rdma_poller_num),以及是否主动放弃CPU(rdma_poller_yield)。轮询模式下还可以设置一个回调函数,在每次轮询时调用,可以配合io_uring/spdk等使用。
5151

5252
`event_dispatcher_edisp_unsched` 是全局开关,同时影响普通模式(TCP)和 RDMA 模式的 EventDispatcher 调度行为。
53-
它用于替代 `rdma_edisp_unsched`。当前保留 `rdma_edisp_unsched` 仅用于兼容历史命令行,未来版本会移除。两者语义一致:值为 `true` 时都表示 EventDispatcher 不可被调度
53+
值为 `true` 时 EventDispatcher 不可被调度,值为 `false` 时保持可调度(默认)
5454

55-
历史说明:之前 RDMA 路径里出现过一次 `if` 判断 bug,导致行为和 flag 语义不一致;当前逻辑已修复,并按统一语义生效。
56-
57-
最终生效条件统一为:
58-
`event_dispatcher_edisp_unsched || rdma_edisp_unsched`
59-
60-
启动时不会再改写用户传入的 flag,运行时严格按用户配置值生效。
55+
运行时严格按用户配置值生效。
6156

6257
推荐使用方式:
63-
1. 新部署:只配置 `event_dispatcher_edisp_unsched`
64-
2. 存量部署:`rdma_edisp_unsched` 仅作过渡兼容,逐步迁移到 `event_dispatcher_edisp_unsched`
65-
3. 避免脚本中给出“冲突值”;在统一 OR 语义下,只要任一 flag 为 `true`,EventDispatcher 就不可调度。
58+
1. 默认不配置,保持 `false`
59+
2. 需要不可调度行为时,设置 `-event_dispatcher_edisp_unsched=true`
6660

6761
行为示例:
68-
1. 仅设置 `-rdma_edisp_unsched=true``rdma_edisp_unsched=true``event_dispatcher_edisp_unsched=false`;TCP和RDMA均不可调度。
69-
2. 仅设置 `-event_dispatcher_edisp_unsched=true``rdma_edisp_unsched=false``event_dispatcher_edisp_unsched=true`;TCP和RDMA均不可调度。
70-
3. 同时设置 `-rdma_edisp_unsched=true -event_dispatcher_edisp_unsched=false``rdma_edisp_unsched=true``event_dispatcher_edisp_unsched=false`;TCP和RDMA均不可调度。
62+
1. `-event_dispatcher_edisp_unsched=false`:TCP 和 RDMA 均可调度。
63+
2. `-event_dispatcher_edisp_unsched=true`:TCP 和 RDMA 均不可调度。
7164

7265
# 参数
7366

@@ -94,5 +87,4 @@ RDMA支持事件驱动和轮询两种模式,默认是事件驱动模式,通
9487
* rdma_poller_num: 轮询模式下的poller数目,默认1。
9588
* rdma_poller_yield: 轮询模式下的poller是否主动放弃CPU,默认是false。
9689
* event_dispatcher_edisp_unsched: 全局开关,控制EventDispatcher是否不可被调度(true时不可调度),默认是false。
97-
* rdma_edisp_unsched: 废弃兼容参数(未来版本计划移除)。当前仍参与统一生效判断,默认是false。
9890
* rdma_disable_bthread: 禁用bthread,默认是false。

docs/en/rdma.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,17 @@ The application can manage memory by itself and send data with IOBuf::append_use
4848
RDMA is hardware-related. It has some different concepts such as device, port, GID, LID, MaxSge and so on. These parameters can be read from NICs at initialization, and brpc will make the default choice (see src/brpc/rdma/rdma_helper.cpp). Sometimes the default choice is not the expectation, then it can be changed in the flag way.
4949

5050
`event_dispatcher_edisp_unsched` is a global flag and affects EventDispatcher scheduling in both normal mode (TCP) and RDMA mode.
51-
It replaces `rdma_edisp_unsched`. `rdma_edisp_unsched` is still kept only for command-line compatibility and is planned for removal in a future release. The two flags have the same semantics: `true` means EventDispatcher is unschedulable.
51+
`true` means EventDispatcher is unschedulable, and `false` means schedulable (default).
5252

53-
Historical note: there was a previous `if`-condition bug on the RDMA path, where behavior did not match the flag semantics. The logic is now fixed and follows the unified semantics.
54-
55-
The effective unsched condition is unified as:
56-
`event_dispatcher_edisp_unsched || rdma_edisp_unsched`
57-
58-
No startup synchronization rewrites user flags. Runtime behavior is determined directly from user-provided values.
53+
Runtime behavior is determined directly from user-provided values.
5954

6055
Recommended usage:
61-
1. New deployment: set only `event_dispatcher_edisp_unsched`.
62-
2. Existing deployment: keep `rdma_edisp_unsched` temporarily, but migrate to `event_dispatcher_edisp_unsched`.
63-
3. Avoid conflicting values in scripts; with unified OR semantics, either flag being `true` makes EventDispatcher unschedulable.
56+
1. Keep the default `false` when unsched is not needed.
57+
2. Set `-event_dispatcher_edisp_unsched=true` when unsched behavior is required.
6458

6559
Examples:
66-
1. Only `-rdma_edisp_unsched=true`: `rdma_edisp_unsched=true`, `event_dispatcher_edisp_unsched=false`; both TCP and RDMA are unschedulable.
67-
2. Only `-event_dispatcher_edisp_unsched=true`: `rdma_edisp_unsched=false`, `event_dispatcher_edisp_unsched=true`; both TCP and RDMA are unschedulable.
68-
3. Both `-rdma_edisp_unsched=true -event_dispatcher_edisp_unsched=false`: `rdma_edisp_unsched=true`, `event_dispatcher_edisp_unsched=false`; both TCP and RDMA are unschedulable.
60+
1. `-event_dispatcher_edisp_unsched=false`: both TCP and RDMA are schedulable.
61+
2. `-event_dispatcher_edisp_unsched=true`: both TCP and RDMA are unschedulable.
6962

7063
# Parameters
7164

@@ -92,5 +85,4 @@ Configurable parameters:
9285
* rdma_poller_num: The number of pollers in polling mode, default is 1.
9386
* rdma_poller_yield: Whether pollers in polling mode voluntarily relinquish the CPU, default is false.
9487
* event_dispatcher_edisp_unsched: Global switch for EventDispatcher scheduling (true means unschedulable), default is false.
95-
* rdma_edisp_unsched: Deprecated compatibility flag (planned removal in a future release). It still participates in unified unsched condition, default is false.
9688
* rdma_disable_bthread: Disables bthread, default is false.

src/brpc/event_dispatcher.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,6 @@ DEFINE_int32(event_dispatcher_num, 1, "Number of event dispatcher");
3333
DEFINE_bool(event_dispatcher_edisp_unsched, false,
3434
"Disable event dispatcher schedule");
3535

36-
#if BRPC_WITH_RDMA
37-
namespace rdma {
38-
DEFINE_bool(rdma_edisp_unsched, false,
39-
"Deprecated and will be removed in a future release, "
40-
"use event_dispatcher_edisp_unsched instead");
41-
} // namespace rdma
42-
#endif
43-
4436
DEFINE_bool(usercode_in_pthread, false,
4537
"Call user's callback in pthreads, use bthreads otherwise");
4638
DEFINE_bool(usercode_in_coroutine, false,
@@ -52,12 +44,7 @@ static bvar::LatencyRecorder* g_edisp_write_lantency = NULL;
5244
static pthread_once_t g_edisp_once = PTHREAD_ONCE_INIT;
5345

5446
bool EventDispatcherUnsched() {
55-
#if BRPC_WITH_RDMA
56-
return FLAGS_event_dispatcher_edisp_unsched ||
57-
rdma::FLAGS_rdma_edisp_unsched;
58-
#else
5947
return FLAGS_event_dispatcher_edisp_unsched;
60-
#endif
6148
}
6249

6350
static void StopAndJoinGlobalDispatchers() {

0 commit comments

Comments
 (0)