已合并
[Feat] epoll/poll/seleclt malloc optimize #241
xhpintell创建于 2 天前
[Feat] epoll/poll/seleclt malloc optimize #241
已合并
xhpintell创建于 2 天前
xhpintell
xhpintell成员
2 天前

当前PR是否有AI参与:

[x] 否

[ ] 是
__1. AI Agent 平台:
__2. AI 模型:
__3. Prompt上下文 :

参考:openEuler社区《生成式AI工具使用与开源贡献政策》

PR功能描述 / 为什么需要这个合入**:

[描述信息]:Feat: epoll/poll/seleclt malloc optimize
[原因分析]:多线程情况下,监听的notify SHM_MALLOC竞争严重,采用OS_MALLOC
[修改说明]:将SHM_MALLOC替换为OS_MALLOC
[测试结果]:1.gaussdb场景验证无问题 2.sdv用例全跑通。

该PR关联的issue

(格式为fixes #<issue号>, 或者resolves #<issue号>): fixes #

希望检视人员了解:

likedislike
Pull Request已成功合入, 合并人@openeuler-ci-bot
(感谢 xhpintell 的贡献)
xhpintellxhpintell成员
2 天前 创建了 pull request,commit 815701d1
atomgit-bot
atomgit-bot
2 天前 评论:

变更摘要

此 PR 主要对 epoll/poll/select 子系统中的内存分配方式进行优化:将 SockNotify_t 结构体的分配与释放从共享内存接口 (SHM_MALLOC/SHM_FREE) 切换为 OS 堆内存接口 (OS_MALLOC/OS_FREE),涉及 sock.cepoll.cpoll.cselect.c 四个文件。同时调整了两个宏常量:KNET_POLL_MAX_NUM 从 1024 提升至 8192,MBUF_BATCH_THREAD_NUM 从 256 降低至 128。

主要改动

  • SockNotify_t 内存分配方式切换:在 sock.cSOCK_EnableNotify 中将 SHM_MALLOC 替换为 OS_MALLOC,在 SOCK_DisableNotifySOCK_DisableNotifyWithoutHook 中将 SHM_FREE 替换为 OS_FREE,统一使用 OS 堆内存管理 notify 对象。

  • epoll 模块 notify 释放方式对齐:在 epoll.cDisableSockNotifyDeleteEpollItem 中,将 SHM_FREE(notify, DP_MEM_FREE) 替换为 OS_FREE(notify),与新的分配方式保持一致。

  • poll 模块 notify 释放方式对齐:在 poll.cDisableNotifySafe 中,将 SHM_FREE(notify, DP_MEM_FREE) 替换为 OS_FREE(notify)

  • select 模块 notify 释放方式对齐:在 select.cDisableNotifySafe 中,将 SHM_FREE(notify, DP_MEM_FREE) 替换为 OS_FREE(notify)

  • 常量调整KNET_POLL_MAX_NUM 从 1024 提升至 8192,扩大了 poll 可监听的最大文件描述符数量;MBUF_BATCH_THREAD_NUM 从 256 降低至 128,缩减了 mbuf 批量处理线程数组的内存占用。

likedislike
atomgit-bot
atomgit-bot
2 天前 评论:

代码审查

✅ 未发现问题

likedislike
openeuler-ci-botopeneuler-ci-bot成员
2 天前 将hlinbo,shw030915,Gao_Victor,qmyyxtl,caowaterman设为审查人
openeuler-ci-botopeneuler-ci-bot成员
2 天前 添加了label:sig/sig-UB-ServiceCore
此处折叠了48条消息 查看更多
xhpintellxhpintell成员
1 天前 修改标题为 “[Feat] epoll/poll/seleclt malloc optimize”,原标题为“Feat: epoll/poll/seleclt malloc optimize”
huang_bing_kang成员
1 天前 评论:

/lgtm
/approve

likedislike
openeuler-ci-botopeneuler-ci-bot成员
1 天前 添加了label:approvedlgtm
openeuler-ci-bot
openeuler-ci-bot成员
1 天前 评论:

Review Code Feedback

  • The label lgtm, approved was added to this pull request. It means that huang_bing_kang reviewed the code changes. 👋
Tips
  • If this pull request is not merged while all conditions are met, comment /check-pr to try again. 😄
likedislike
openeuler-ci-botopeneuler-ci-bot成员
1 天前 合入了pull request,合并节点 SHA:dc032afa09d3506209635a09016df7fd1293b67e