You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes CPU affinity updates not being applied to already running agent threads, and replaces manual procfs thread scanning with the procfs library
Steps to reproduce the bug
Start a managed deepflow-agent and let it create its normal runtime worker threads.
Update global.tunning.cpu_affinity from deepflow-server for the agent group after those threads are already running.
Observe that the new CPU affinity setting is expected to apply to all existing agent threads, not only to threads created later.
In the original implementation, the rebinding logic depended on manual reads from /proc/self/task and /proc/self/task/<tid>/comm.
This made the thread scanning code harder to maintain and duplicated functionality already provided by the procfs crate.
Changes to fix the bug
Apply CPU affinity updates to already existing agent threads when global.tunning.cpu_affinity changes, instead of limiting the effect to threads
created after startup.
Keep scanning multiple times so newly discovered threads created during the rebinding window can also be covered.
Continue skipping self-managed kick-kern.* eBPF threads during CPU affinity rebinding.
Replace manual /proc/self/task directory traversal with procfs::process::Process::myself()?.tasks()?.
Replace direct reads of /proc/self/task/<tid>/comm with task.status()?.name.
Add a small procfs::ProcError to io::Error conversion helper so the existing retry and error-handling flow remains unchanged.
Preserve the original tolerance for disappearing threads by continuing on NotFound errors during task enumeration and thread name resolution.
Affected branches
main
Checklist
Added unit test to verify the fix.
Verified eBPF program runs successfully on linux 4.14.x.
Verified eBPF program runs successfully on linux 4.19.x.
Verified eBPF program runs successfully on linux 5.2.x.
Verified eBPF program runs successfully on linux 5.4.x.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is for:
Fixes CPU affinity updates not being applied to already running agent threads, and replaces manual procfs thread scanning with the procfs library
Steps to reproduce the bug
global.tunning.cpu_affinityfrom deepflow-server for the agent group after those threads are already running./proc/self/taskand/proc/self/task/<tid>/comm.procfscrate.Changes to fix the bug
global.tunning.cpu_affinitychanges, instead of limiting the effect to threadscreated after startup.
kick-kern.*eBPF threads during CPU affinity rebinding./proc/self/taskdirectory traversal withprocfs::process::Process::myself()?.tasks()?./proc/self/task/<tid>/commwithtask.status()?.name.procfs::ProcErrortoio::Errorconversion helper so the existing retry and error-handling flow remains unchanged.NotFounderrors during task enumeration and thread name resolution.Affected branches
Checklist