Skip to content

chore: make d_instantiate_ctx size configurable - #1453

Open
Molter73 wants to merge 1 commit into
mauro/ROX-34920/track-symlinksfrom
mauro/chore/configurable-d-instantiate-ctx
Open

chore: make d_instantiate_ctx size configurable#1453
Molter73 wants to merge 1 commit into
mauro/ROX-34920/track-symlinksfrom
mauro/chore/configurable-d-instantiate-ctx

Conversation

@Molter73

@Molter73 Molter73 commented Aug 12, 2026

Copy link
Copy Markdown
Member

Description

With the changes introduced by #1440, the d_instantiate_ctx map has grown considerably in size. This patch reduces the default size and exposes a method for setting the size at runtime for fine-tweaking.

Checklist

  • Patch has a change log entry OR does not need one.
  • Investigated and inspected CI test results
  • Updated documentation accordingly

Automated testing

  • Added unit tests
  • Added integration tests
  • Added regression tests

If any of these don't apply, please comment below.

Testing Performed

Run fact with --d-inst-size 65535 and use bpftool map show to check the map max_entries is properly set:

31236: lru_hash  name d_instantiate_c  flags 0x0
	key 8B  value 12320B  max_entries 655535  memlock 8129679272B
	btf_id 13108
	pids fact(751156)

Summary by CodeRabbit

  • New Features

    • Added configuration support for tuning the BPF context map capacity.
    • The setting can be specified through configuration files, environment variables, and command-line options.
    • Defaults to 512 entries when not configured.
    • Invalid or out-of-range values are rejected with an error.
  • Bug Fixes

    • Ensured the configured capacity is applied when loading BPF components.

@Molter73
Molter73 requested a review from a team as a code owner August 12, 2026 09:24
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Enterprise

Run ID: 06775a97-d642-4415-a4ab-5f5171f5ab6a

📥 Commits

Reviewing files that changed from the base of the PR and between fbcddc8 and cfc8a73.

📒 Files selected for processing (1)
  • fact/src/config/mod.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • fact/src/config/mod.rs

📝 Walkthrough

Walkthrough

Changes

The PR adds bpf.d_instantiate_ctx_size configuration through YAML, CLI, and environment variables. It validates positive values below u32::MAX, defaults to 512, and applies the value to the eBPF map loader. Tests cover parsing, precedence, updates, defaults, and invalid values.

D-instantiate context map configuration

Layer / File(s) Summary
Configuration sources and validation
fact/src/config/mod.rs
BpfConfig stores and exposes d_instantiate_ctx_size. YAML, CLI, and environment configuration support the setting. Higher-precedence values update the configuration.
Configuration behavior tests
fact/src/config/tests.rs
Tests cover parsing, validation, updates, defaults, environment variables, precedence, and invalid values.
Loader and eBPF map wiring
fact/src/bpf/mod.rs, fact-ebpf/src/bpf/maps.h
The loader applies the configured map size. The eBPF map declaration defaults to 512 entries.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: making the d_instantiate_ctx map size configurable.
Description check ✅ Passed The description explains the change, records testing steps, and identifies unit tests, with only non-critical checklist items left unchecked.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mauro/chore/configurable-d-instantiate-ctx

Comment @coderabbitai help to get the list of available commands.

@Molter73 Molter73 mentioned this pull request Aug 12, 2026
6 tasks
@codecov-commenter

codecov-commenter commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 34.45%. Comparing base (40459ba) to head (cfc8a73).

Files with missing lines Patch % Lines
fact/src/bpf/mod.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                        Coverage Diff                         @@
##           mauro/ROX-34920/track-symlinks    #1453      +/-   ##
==================================================================
+ Coverage                           34.18%   34.45%   +0.26%     
==================================================================
  Files                                  22       22              
  Lines                                3358     3373      +15     
  Branches                             3358     3373      +15     
==================================================================
+ Hits                                 1148     1162      +14     
- Misses                               2205     2206       +1     
  Partials                                5        5              

☔ View full report in Codecov by Harness.
📢 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.

@Molter73
Molter73 force-pushed the mauro/chore/configurable-d-instantiate-ctx branch from 80a351c to fbcddc8 Compare August 12, 2026 09:56

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@fact/src/config/mod.rs`:
- Around line 866-873: Update the d_instantiate_ctx_size argument definition and
its parsing path to reject 0 and u32::MAX, accepting only values in the YAML
range 1..u32::MAX before they reach map_max_entries. Add CLI and
environment-variable tests covering both rejected boundaries, using the existing
configuration test patterns and symbols.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Enterprise

Run ID: 30975ee3-84da-4b56-bd53-8dd8227eb1a5

📥 Commits

Reviewing files that changed from the base of the PR and between bb01edc and fbcddc8.

📒 Files selected for processing (4)
  • fact-ebpf/src/bpf/maps.h
  • fact/src/bpf/mod.rs
  • fact/src/config/mod.rs
  • fact/src/config/tests.rs

Comment thread fact/src/config/mod.rs
With the changes introduced by #1440, the d_instantiate_ctx map has
grown considerably in size. This patch reduces the default size and
exposes a method for setting the size at runtime for fine-tweaking.
@Molter73
Molter73 force-pushed the mauro/chore/configurable-d-instantiate-ctx branch from fbcddc8 to cfc8a73 Compare August 12, 2026 16:16
@Molter73

Copy link
Copy Markdown
Member Author

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants