1 Star 0 Fork 32

吴昌盛/gazelle-tar

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0108-avoid-useless-stack-check-wakeup-event.patch 1.97 KB
一键复制 编辑 原始数据 按行查看 历史
吴昌盛 提交于 2022-10-08 22:27 . adapt ceph client
From 315f57f4bed8aeaa375f7f326ab8723f21082e9a Mon Sep 17 00:00:00 2001
From: wu-changsheng <wuchangsheng2@huawei.com>
Date: Sun, 9 Oct 2022 22:15:19 +0800
Subject: [PATCH] avoid useless stack check wakeup event
---
src/lstack/api/lstack_epoll.c | 1 +
src/lstack/core/lstack_protocol_stack.c | 4 +++-
src/lstack/include/lstack_protocol_stack.h | 1 +
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
index dcd58e7..4da88b0 100644
--- a/src/lstack/api/lstack_epoll.c
+++ b/src/lstack/api/lstack_epoll.c
@@ -50,6 +50,7 @@ void add_sock_event(struct lwip_sock *sock, uint32_t event)
}
wakeup->have_event = true;
+ sock->stack->have_event = true;
if (wakeup->type == WAKEUP_POLL) {
return;
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index 8283a41..71412b4 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -355,7 +355,7 @@ static struct protocol_stack *stack_thread_init(uint16_t queue_id)
static void wakeup_stack_wait(struct protocol_stack *stack)
{
- if (pthread_spin_trylock(&stack->wakeup_list_lock)) {
+ if (!stack->have_event || pthread_spin_trylock(&stack->wakeup_list_lock)) {
return;
}
@@ -369,6 +369,8 @@ static void wakeup_stack_wait(struct protocol_stack *stack)
}
pthread_spin_unlock(&stack->wakeup_list_lock);
+
+ stack->have_event = false;
}
static void* gazelle_stack_thread(void *arg)
diff --git a/src/lstack/include/lstack_protocol_stack.h b/src/lstack/include/lstack_protocol_stack.h
index f58ae56..4249217 100644
--- a/src/lstack/include/lstack_protocol_stack.h
+++ b/src/lstack/include/lstack_protocol_stack.h
@@ -62,6 +62,7 @@ struct protocol_stack {
struct list_node recv_list;
struct list_node send_list;
+ bool have_event;
volatile uint16_t conn_num;
struct stats_ *lwip_stats;
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wu-changsheng/gazelle-tar.git
git@gitee.com:wu-changsheng/gazelle-tar.git
wu-changsheng
gazelle-tar
gazelle-tar
master

搜索帮助