Skip to content

wip: new(libsinsp): prepare built in tables for multithreading support#2804

Draft
gnosek wants to merge 62 commits intofalcosecurity:masterfrom
gnosek:table-cleanup
Draft

wip: new(libsinsp): prepare built in tables for multithreading support#2804
gnosek wants to merge 62 commits intofalcosecurity:masterfrom
gnosek:table-cleanup

Conversation

@gnosek
Copy link
Contributor

@gnosek gnosek commented Jan 21, 2026

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind test

/kind feature

/kind sync

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area API-version

/area build

/area CI

/area driver-kmod

/area driver-bpf

/area driver-modern-bpf

/area libscap-engine-bpf

/area libscap-engine-gvisor

/area libscap-engine-kmod

/area libscap-engine-modern-bpf

/area libscap-engine-nodriver

/area libscap-engine-noop

/area libscap-engine-source-plugin

/area libscap-engine-savefile

/area libscap

/area libpman

/area libsinsp

/area tests

/area proposals

Does this PR require a change in the driver versions?

/version driver-API-version-major

/version driver-API-version-minor

/version driver-API-version-patch

/version driver-SCHEMA-version-major

/version driver-SCHEMA-version-minor

/version driver-SCHEMA-version-patch

What this PR does / why we need it:

This PR is not intended to be merged, just to show where we're going with #2802. It should get shorter over time as we merge the individual PRs (that should be easier to review than this whole series).

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@poiana
Copy link
Contributor

poiana commented Jan 21, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gnosek

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions
Copy link

github-actions bot commented Jan 21, 2026

Perf diff from master - unit tests

     7.20%    +22.23%  [.] std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count(std::__weak_count<(__gnu_cxx::_Lock_policy)2> const&, std::nothrow_t)
    15.72%    -11.44%  [.] std::__shared_count<(__gnu_cxx::_Lock_policy)2>::_M_get_use_count() const
    17.77%     -6.31%  [.] std::__shared_ptr<sinsp_threadinfo, (__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__weak_ptr<sinsp_threadinfo, (__gnu_cxx::_Lock_policy)2> const&, std::nothrow_t)
     5.66%     +4.55%  [.] thread_group_info::get_first_thread() const
     9.06%     -2.65%  [.] sinsp_threadinfo::get_fd_table()
    10.58%     +1.03%  [.] std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_add_ref_lock_nothrow()
     4.21%     +0.36%  [.] sinsp_thread_manager::create_thread_dependencies(std::shared_ptr<sinsp_threadinfo> const&)
    12.87%     +0.34%  [.] sinsp_threadinfo::get_main_thread()
    10.73%     +0.17%  [.] std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release()
     0.14%     +0.11%  [.] sinsp_utils::find_longest_matching_evt_param(std::basic_string_view<char, std::char_traits<char> >)

Heap diff from master - unit tests

peak heap memory consumption: 14.88M
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Heap diff from master - scap file

peak heap memory consumption: 373.46K
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Benchmarks diff from master

Comparing gbench_data.json to /root/actions-runner/_work/libs/libs/build/gbench_data.json
Benchmark                                                         Time             CPU      Time Old      Time New       CPU Old       CPU New
----------------------------------------------------------------------------------------------------------------------------------------------
BM_sinsp_split_mean                                            +0.0137         +0.0136           240           243           239           243
BM_sinsp_split_median                                          +0.0148         +0.0145           239           243           239           243
BM_sinsp_split_stddev                                          -0.6346         -0.6449             3             1             3             1
BM_sinsp_split_cv                                              -0.6395         -0.6496             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  +0.0353         +0.0353            70            73            70            73
BM_sinsp_concatenate_paths_relative_path_median                +0.0347         +0.0347            70            73            70            73
BM_sinsp_concatenate_paths_relative_path_stddev                +7.8365         +7.3312             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_cv                    +7.5354         +7.0472             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     -0.1009         -0.1010            44            40            44            40
BM_sinsp_concatenate_paths_empty_path_median                   -0.1014         -0.1015            44            40            44            40
BM_sinsp_concatenate_paths_empty_path_stddev                   -0.7898         -0.7967             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       -0.7663         -0.7739             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  +0.0025         +0.0026            69            69            69            69
BM_sinsp_concatenate_paths_absolute_path_median                +0.0054         +0.0055            69            69            69            69
BM_sinsp_concatenate_paths_absolute_path_stddev                -0.5208         -0.5215             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_cv                    -0.5220         -0.5227             0             0             0             0

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 82.55977% with 124 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.11%. Comparing base (bc7ecaa) to head (29da4d6).

Files with missing lines Patch % Lines
userspace/libsinsp/state/table_entry.h 76.00% 24 Missing ⚠️
userspace/libsinsp/state/table.cpp 52.38% 20 Missing ⚠️
userspace/libsinsp/state/table_adapters.h 64.91% 20 Missing ⚠️
userspace/libsinsp/fdinfo.cpp 77.27% 15 Missing ⚠️
userspace/libsinsp/state/static_struct.h 68.57% 11 Missing ⚠️
userspace/libsinsp/state/borrowed_state_data.h 72.00% 7 Missing ⚠️
userspace/libsinsp/state/type_info.h 56.25% 7 Missing ⚠️
userspace/libsinsp/sinsp_filtercheck_thread.cpp 60.00% 4 Missing ⚠️
userspace/libsinsp/plugin.h 57.14% 3 Missing ⚠️
userspace/libsinsp/plugin_table_api.cpp 40.00% 3 Missing ⚠️
... and 6 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2804      +/-   ##
==========================================
- Coverage   75.22%   75.11%   -0.12%     
==========================================
  Files         295      296       +1     
  Lines       31107    31113       +6     
  Branches     4858     4849       -9     
==========================================
- Hits        23399    23369      -30     
- Misses       7708     7744      +36     
Flag Coverage Δ
libsinsp 75.11% <82.55%> (-0.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gnosek
Copy link
Contributor Author

gnosek commented Jan 21, 2026

Of course I can't repro the ASAN/UBSAN failures locally 🙃

gnosek added 29 commits March 4, 2026 17:27
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
…nctions

Signed-off-by: Grzegorz Nosek <grzegorz.nosek@sysdig.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants