1 Star 0 Fork 18

Younger/libwd

forked from src-openEuler/libwd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0017-uadk-fix-numa-array-use-too-much-stack-space.patch 1.80 KB
一键复制 编辑 原始数据 按行查看 历史
From 4a15745d3544eae2c41419d5fb64802e2a16a9f5 Mon Sep 17 00:00:00 2001
From: Wenkai Lin <linwenkai6@hisilicon.com>
Date: Thu, 30 Dec 2021 12:07:31 +0800
Subject: [PATCH 19/28] uadk: fix numa array use too much stack space
numa array will take 32768 bytes, too big for
a process, replace it by check numa invalid status.
Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com>
---
wd_sched.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/wd_sched.c b/wd_sched.c
index 3330a4d..f97c15f 100644
--- a/wd_sched.c
+++ b/wd_sched.c
@@ -202,10 +202,8 @@ static int session_sched_poll_policy(handle_t sched_ctx,
{
struct wd_sched_ctx *ctx = (struct wd_sched_ctx *)sched_ctx;
struct wd_sched_info *sched_info;
- __u16 numa[NUMA_NUM_NODES];
__u32 loop_time = 0;
__u32 last_count = 0;
- __u16 tail = 0;
__u16 i;
int ret;
@@ -220,9 +218,6 @@ static int session_sched_poll_policy(handle_t sched_ctx,
}
sched_info = ctx->sched_info;
- for (i = 0; i < ctx->numa_num; i++)
- if (sched_info[i].valid)
- numa[tail++]= i;
/*
* Try different numa's ctx if we can't receive any
@@ -231,15 +226,25 @@ static int session_sched_poll_policy(handle_t sched_ctx,
*/
while (loop_time < MAX_POLL_TIMES) {
loop_time++;
- for (i = 0; i < tail;) {
+ for (i = 0; i < ctx->numa_num;) {
+ /* If current numa is not valid, find next. */
+ if (!sched_info[i].valid) {
+ i++;
+ continue;
+ }
+
last_count = *count;
- ret = session_poll_policy_rr(ctx, numa[i], expect, count);
+ ret = session_poll_policy_rr(ctx, i, expect, count);
if (ret)
return ret;
if (expect == *count)
return 0;
+ /*
+ * If no package is received, find next numa,
+ * otherwise, keep receiving packets at this node.
+ */
if (last_count == *count)
i++;
}
--
2.31.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/aichixxbg/libwd.git
git@gitee.com:aichixxbg/libwd.git
aichixxbg
libwd
libwd
master

搜索帮助