dae icon indicating copy to clipboard operation
dae copied to clipboard

optimize(bpf): Delete tgid_pname_map

Open jschwinger233 opened this issue 6 months ago • 4 comments

Background

tgid_pname_map 只是用在 cookie_pid_map update 失败时的 fallback:

  1. cookie_pid_map update 失败是少见的情况,在正常场景下不需维护 tgid_pname_map。
  2. 就算是 cookie_pid_map update 失败,先 _update_map_elem_by_cookie() 里 tgid_pname_map[pid] = val 再在上层函数 update_map_elem_by_cookie() 里读 tgid_pname_map[pid] 也是多此一举,一个指针传递就行了,无需用 map。

这个 PR 直接删去了 cookie_pid_map 同时维持了 fallback 逻辑,减小了内核内存消耗,整整 8192 * (4 + 16) = 163840 bytes = 0.16384 Mb 呢!同时省去了 wan 代理时对每个 socket 的一次 map 操作,提升全局性能。

Checklist

  • [ ] The Pull Request has been fully tested
  • [ ] There's an entry in the CHANGELOGS
  • [ ] There is a user-facing docs PR against https://github.com/daeuniverse/dae

Full Changelogs

  • [Implement ...]

Issue Reference

Closes #[issue number]

Test Result

jschwinger233 avatar Jun 13 '25 13:06 jschwinger233

求更新

ppdragon16 avatar Jul 17 '25 00:07 ppdragon16

求更新

[!NOTE] The following content has been translated from its original language using an automated process powered by a proprietary API. Segments originally written in English have been preserved, while non-English portions have been machine-translated for readability. Please be aware that minor inaccuracies may exist due to the automated nature of the translation.

Requesting an update.

dae-intelligence[bot] avatar Jul 17 '25 00:07 dae-intelligence[bot]

更新啥 没人review 😢

jschwinger233 avatar Jul 17 '25 02:07 jschwinger233

更新啥 没人review 😢

[!NOTE] The following content has been translated from its original language using an automated process powered by a proprietary API. Segments originally written in English have been preserved, while non-English portions have been machine-translated for readability. Please be aware that minor inaccuracies may exist due to the automated nature of the translation.

Update what? No one reviews 😢

dae-intelligence[bot] avatar Jul 17 '25 02:07 dae-intelligence[bot]