Open
Conversation
Molter73
reviewed
Mar 26, 2024
8c3f916 to
b2120ec
Compare
2b29682 to
15bed83
Compare
sinsp_threadinfo contains two fields with user and login_user
information. Since those fields are of scap_userinfo type and statically
allocated, they take a lot of space:
scap_userinfo m_user; /* 368 2312 */
scap_userinfo m_loginuser; /* 2680 2312 */
which is 4624 bytes out of 5728 for the whole sinsp_threadinfo:
/* size: 5728, cachelines: 90, members: 64 */
Most of this memory is coming from the fields name
(MAX_CREDENTIALS_STR_LEN), homedir and shell (both SCAP_MAX_PATH_SIZE).
For a process-heavy workload this can mean a lot of memory taken for
these purposes.
To make memory management more flexible, split m_user/m_loginuser into
two set of fields:
* one containing uid/gid, which are ubiquitous and generally used
everywhere
* one for the rest of heavy details, which are needed less often
The new sinsp_userinfo class is not supposed to use separately from
sinsp_threadinfo, thus it's defined inside the class.
Co-authored-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
15bed83 to
947a2ff
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In order to make memory management more flexible, split user info stored in
sinsp_threadinfointo essential and extended parts. This can have significant impact in case of process-heavy workloads, as in the example below:The memory usage breakdown shows that most of it goes to manage
sinsp_threadinfo(where_M_allocate_nodeis a part of threadinfo allocationprocess, e.g. in
get_thread_ref):