代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gazelle 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。