Skip to content

Conversation

Copy link

Copilot AI commented Nov 30, 2025

Performance optimizations for the flat array domain's coalesced hash table lookup path.

Changes

  • Force inlining: Apply __always_inline to all hot path functions (h_find, dom_index_hash_func, landlock_domain_find, generated accessors in DEFINE_COALESCED_HASH_TABLE)

  • Branch hints: Add likely()/unlikely() annotations:

    • Fast path element comparison
    • Empty table check
    • Zero hash_bits edge case
  • Early termination: Skip collision chain traversal when element at hash position doesn't belong there—indicates no matching element exists

  • Bounds checking: Add WARN_ON_ONCE guard in collision chain traversal

// Early termination: avoid traversing chains that can't contain our element
if (hash_elem(curr_elem, table_size, hash_bits) != target_hash)
    return NULL;

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copy link
Author

Copilot AI commented Nov 30, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Refactor Landlock to use flat array domains landlock: Optimize coalesced hash table lookup performance Nov 30, 2025
Copilot AI requested a review from micromaomao November 30, 2025 19:49
@micromaomao micromaomao force-pushed the landlock-arraydomain branch 2 times, most recently from 30a910d to d07afd9 Compare November 30, 2025 20:34
Copilot AI and others added 5 commits November 30, 2025 23:06
…tch, branch hints, and early termination

Co-authored-by: micromaomao <6070533+micromaomao@users.noreply.github.com>
… termination trade-off

Co-authored-by: micromaomao <6070533+micromaomao@users.noreply.github.com>
Co-authored-by: micromaomao <6070533+micromaomao@users.noreply.github.com>
Co-authored-by: micromaomao <6070533+micromaomao@users.noreply.github.com>
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