代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gazelle 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From b658a975bb76d3b39edb7fd73ab5815c302bce02 Mon Sep 17 00:00:00 2001
From: kircher <majun65@huawei.com>
Date: Tue, 21 Mar 2023 11:08:46 +0800
Subject: [PATCH] gazelle send/recv thread bind numa
---
src/lstack/core/lstack_lwip.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index 60abfe8..7355d7b 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -97,6 +97,7 @@ static void reset_sock_data(struct lwip_sock *sock)
sock->events = 0;
sock->call_num = 0;
sock->remain_len = 0;
+ sock->already_bind_numa = 0;
if (sock->recv_lastdata) {
pbuf_free(sock->recv_lastdata);
@@ -882,6 +883,21 @@ ssize_t gazelle_same_node_ring_send(struct lwip_sock *sock, const void *buf, siz
return act_len;
}
+PER_THREAD uint16_t stack_sock_num[GAZELLE_MAX_STACK_NUM] = {0};
+PER_THREAD uint16_t max_sock_stack = 0;
+
+static void thread_bind_stack(struct lwip_sock *sock) {
+ if (likely(!sock->stack || sock->already_bind_numa)) {
+ return;
+ }
+ sock->already_bind_numa = 1;
+ stack_sock_num[sock->stack->stack_idx]++;
+ if (stack_sock_num[sock->stack->stack_idx] > max_sock_stack) {
+ max_sock_stack = stack_sock_num[sock->stack->stack_idx];
+ bind_to_stack_numa(sock->stack);
+ }
+}
+
ssize_t gazelle_send(int32_t fd, const void *buf, size_t len, int32_t flags)
{
if (buf == NULL) {
@@ -893,6 +909,9 @@ ssize_t gazelle_send(int32_t fd, const void *buf, size_t len, int32_t flags)
}
struct lwip_sock *sock = get_socket_by_fd(fd);
+
+ thread_bind_stack(sock);
+
if (sock->same_node_tx_ring != NULL) {
return gazelle_same_node_ring_send(sock, buf, len, flags);
}
@@ -973,6 +992,8 @@ ssize_t read_stack_data(int32_t fd, void *buf, size_t len, int32_t flags)
return 0;
}
+ thread_bind_stack(sock);
+
if (sock->same_node_rx_ring != NULL) {
return gazelle_same_node_ring_recv(sock, buf, len, flags);
}
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。