1 Star 0 Fork 32

fantaotao1/gazelle

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0006-reduce-replenish-send_idle_ring-rpc-call.patch 2.32 KB
一键复制 编辑 原始数据 按行查看 历史
jinag12 提交于 2022-03-16 22:23 . fix gazelle test issue
From 7b7dd1bdda75f8877e57f3b29432e3e1686bf9b5 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng12@huawei.com>
Date: Mon, 7 Mar 2022 23:35:07 +0800
Subject: [PATCH 06/34] reduce replenish send_idle_ring rpc call
---
src/lstack/core/lstack_lwip.c | 4 ++--
src/lstack/core/lstack_thread_rpc.c | 2 ++
src/lstack/include/lstack_protocol_stack.h | 1 +
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index 0a71aae..a9ef824 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -240,7 +240,7 @@ void stack_replenish_send_idlembuf(struct protocol_stack *stack)
ssize_t write_lwip_data(struct lwip_sock *sock, int32_t fd, int32_t flags)
{
struct pbuf *pbuf = NULL;
- ssize_t send_ret;
+ ssize_t send_ret = 0;
ssize_t send_len = 0;
do {
@@ -327,7 +327,7 @@ ssize_t write_stack_data(struct lwip_sock *sock, const void *buf, size_t len)
sock->have_event = false;
}
- if (rte_ring_free_count(sock->stack->send_idle_ring) > USED_IDLE_WATERMARK) {
+ if (rte_ring_free_count(sock->stack->send_idle_ring) > USED_IDLE_WATERMARK && !sock->stack->in_replenish) {
rpc_call_replenish_idlembuf(sock->stack);
}
diff --git a/src/lstack/core/lstack_thread_rpc.c b/src/lstack/core/lstack_thread_rpc.c
index 1ed20dd..8b3d36c 100644
--- a/src/lstack/core/lstack_thread_rpc.c
+++ b/src/lstack/core/lstack_thread_rpc.c
@@ -194,10 +194,12 @@ static void rpc_replenish_idlembuf(struct rpc_msg *msg)
{
struct protocol_stack *stack = get_protocol_stack();
stack_replenish_send_idlembuf(stack);
+ stack->in_replenish = 0;
}
void rpc_call_replenish_idlembuf(struct protocol_stack *stack)
{
+ stack->in_replenish = 1;
struct rpc_msg *msg = rpc_msg_alloc(stack->rpc_pool, rpc_replenish_idlembuf);
if (msg == NULL) {
return;
diff --git a/src/lstack/include/lstack_protocol_stack.h b/src/lstack/include/lstack_protocol_stack.h
index 3c49bd5..1020e83 100644
--- a/src/lstack/include/lstack_protocol_stack.h
+++ b/src/lstack/include/lstack_protocol_stack.h
@@ -28,6 +28,7 @@ struct protocol_stack {
uint16_t socket_id;
uint16_t cpu_id;
volatile uint16_t conn_num;
+ volatile bool in_replenish;
// for dispatcher thread
cpu_set_t idle_cpuset;
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fantaotao1/gazelle.git
git@gitee.com:fantaotao1/gazelle.git
fantaotao1
gazelle
gazelle
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385