1 Star 0 Fork 32

fantaotao1/gazelle

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0154-fix-kernel-event-thread-bind-numa-failed.patch 3.93 KB
一键复制 编辑 原始数据 按行查看 历史
jinag12 提交于 2022-12-14 10:12 . fix kernel event thread bind numa failed
From be7a7d55a672a72328f1a6844c610152ea142053 Mon Sep 17 00:00:00 2001
From: jianheng <jiangheng14@huawei.com>
Date: Wed, 14 Dec 2022 09:51:36 +0800
Subject: [PATCH] fix kernel event thread bind numa failed
---
src/lstack/core/lstack_cfg.c | 13 +++++-------
src/lstack/core/lstack_protocol_stack.c | 28 ++++++++++---------------
src/lstack/include/lstack_cfg.h | 3 ++-
3 files changed, 18 insertions(+), 26 deletions(-)
diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
index 1731c0f..81452e8 100644
--- a/src/lstack/core/lstack_cfg.c
+++ b/src/lstack/core/lstack_cfg.c
@@ -329,11 +329,10 @@ static int32_t stack_idle_cpuset(struct protocol_stack *stack, cpu_set_t *exclud
return 0;
}
-int32_t init_stack_numa_cpuset(void)
+int32_t init_stack_numa_cpuset(struct protocol_stack *stack)
{
int32_t ret;
struct cfg_params *cfg = get_global_cfg_params();
- struct protocol_stack_group *stack_group = get_protocol_stack_group();
cpu_set_t stack_cpuset;
CPU_ZERO(&stack_cpuset);
@@ -344,12 +343,10 @@ int32_t init_stack_numa_cpuset(void)
CPU_SET(cfg->wakeup[idx], &stack_cpuset);
}
- for (int32_t idx = 0; idx < stack_group->stack_num; ++idx) {
- ret = stack_idle_cpuset(stack_group->stacks[idx], &stack_cpuset);
- if (ret < 0) {
- LSTACK_LOG(ERR, LSTACK, "thread_get_cpuset stack_%d failed\n", idx);
- return -1;
- }
+ ret = stack_idle_cpuset(stack, &stack_cpuset);
+ if (ret < 0) {
+ LSTACK_LOG(ERR, LSTACK, "thread_get_cpuset stack(%u) failed\n", stack->tid);
+ return -1;
}
return 0;
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index d5830f1..c0925a1 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -352,21 +352,18 @@ static struct protocol_stack *stack_thread_init(uint16_t queue_id)
}
if (init_stack_value(stack, queue_id) != 0) {
- sem_post(&stack_group->thread_phase1);
- free(stack);
- return NULL;
+ goto END;
}
+ if (init_stack_numa_cpuset(stack) < 0) {
+ goto END;
+ }
if (create_affiliate_thread(queue_id, stack_group->wakeup_enable) < 0) {
- sem_post(&stack_group->thread_phase1);
- free(stack);
- return NULL;
+ goto END;
}
if (thread_affinity_init(stack->cpu_id) != 0) {
- sem_post(&stack_group->thread_phase1);
- free(stack);
- return NULL;
+ goto END;
}
RTE_PER_LCORE(_lcore_id) = stack->cpu_id;
@@ -376,9 +373,7 @@ static struct protocol_stack *stack_thread_init(uint16_t queue_id)
if (use_ltran()) {
if (client_reg_thrd_ring() != 0) {
- sem_post(&stack_group->thread_phase1);
- free(stack);
- return NULL;
+ goto END;
}
}
@@ -394,6 +389,10 @@ static struct protocol_stack *stack_thread_init(uint16_t queue_id)
}
return stack;
+END:
+ sem_post(&stack_group->thread_phase1);
+ free(stack);
+ return NULL;
}
static void wakeup_kernel_event(struct protocol_stack *stack)
@@ -526,11 +525,6 @@ int32_t init_protocol_stack(void)
return -1;
}
- ret = init_stack_numa_cpuset();
- if (ret < 0) {
- return -1;
- }
-
return 0;
}
diff --git a/src/lstack/include/lstack_cfg.h b/src/lstack/include/lstack_cfg.h
index 7075bbc..fe92bc9 100644
--- a/src/lstack/include/lstack_cfg.h
+++ b/src/lstack/include/lstack_cfg.h
@@ -16,6 +16,7 @@
#include <lwip/ip_addr.h>
+#include "lstack_protocol_stack.h"
#include "gazelle_opt.h"
#define BASE_BIN_SCALE 2
@@ -97,6 +98,6 @@ int gazelle_copy_param(const char *param, bool is_double,
int *argc, char argv[][PATH_MAX]);
int match_host_addr(uint32_t ipv4);
-int32_t init_stack_numa_cpuset(void);
+int32_t init_stack_numa_cpuset(struct protocol_stack *stack);
#endif /* GAZELLE_NET_CFG_H */
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fantaotao1/gazelle.git
git@gitee.com:fantaotao1/gazelle.git
fantaotao1
gazelle
gazelle
master

搜索帮助