Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/sensors: reduce memory footprint of unused fdinstall maps and various fixes #2563

Merged
merged 3 commits into from
Jun 19, 2024

Conversation

mtardy
Copy link
Member

@mtardy mtardy commented Jun 14, 2024

The code is not great but it fixes the issue, maybe we can do it more elegantly idk

Reduce the kernel memory footprint (accounted by the cgroup memory controller) of the fdinstall feature when unused (around ~11MB per kprobe).

@mtardy mtardy added release-note/bug This PR fixes an issue in a previous release of Tetragon. needs-backport/0.11 needs-backport/1.0 This PR needs backporting to 1.0 needs-backport/1.1 This PR needs backporting to 1.1 and removed needs-backport/0.11 labels Jun 14, 2024
@mtardy mtardy force-pushed the pr/mtardy/fdinstall-map-memory branch 2 times, most recently from 5c19dbd to 1b4c684 Compare June 14, 2024 17:59
@mtardy mtardy marked this pull request as ready for review June 18, 2024 08:04
@mtardy mtardy requested a review from a team as a code owner June 18, 2024 08:04
@mtardy mtardy requested review from kkourt and olsajiri June 18, 2024 08:04
mtardy added 2 commits June 19, 2024 10:38
Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
Previous condition was buggy and should have been:
hasStackTrace = hasStackTrace || KernelStackTrace || UserStackTrace
instead of :
hasStackTrace =  KernelStackTrace || UserStackTrace

Using a function simplify this.

Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
@mtardy mtardy force-pushed the pr/mtardy/fdinstall-map-memory branch from 1b4c684 to f0189d3 Compare June 19, 2024 08:50
Copy link

netlify bot commented Jun 19, 2024

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit f0189d3
🔍 Latest deploy log https://app.netlify.com/sites/tetragon/deploys/66729bdf6081190008a798e5
😎 Deploy Preview https://deploy-preview-2563--tetragon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mtardy mtardy requested a review from olsajiri June 19, 2024 08:51
@mtardy mtardy force-pushed the pr/mtardy/fdinstall-map-memory branch from f0189d3 to a44a1fa Compare June 19, 2024 09:07
Copy link
Contributor

@kkourt kkourt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a minor not for your consideration.

pkg/sensors/tracing/generictracepoint.go Outdated Show resolved Hide resolved
Resize the fdinstall_map if needed to save memory, thus we are saving
~11MB of kernel memory by kprobe that are not using FollowFD, UnfollowFD
or CopyFD.

Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
@mtardy mtardy force-pushed the pr/mtardy/fdinstall-map-memory branch from a44a1fa to 2631f9b Compare June 19, 2024 10:45
@mtardy mtardy merged commit 2b31289 into main Jun 19, 2024
43 checks passed
@mtardy mtardy deleted the pr/mtardy/fdinstall-map-memory branch June 19, 2024 11:38
@mtardy mtardy added backport-done/1.0 backport-done/1.1 The backport of this PR is complete and removed needs-backport/1.0 This PR needs backporting to 1.0 needs-backport/1.1 This PR needs backporting to 1.1 labels Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-done/1.0 backport-done/1.1 The backport of this PR is complete release-note/bug This PR fixes an issue in a previous release of Tetragon.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants