← Back to Pull requests

UCS/NETLINK: Expire kernel route cache entries #12424

Open
unknown opened this pull request with 283 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 23, 2026 10:20 UTC
Author

What?


Expire the entries of the kernel route lookup cache used by UCX_IB_ROCE_REACHABILITY_MODE=kernel, after a new global option UCX_NETLINK_ROUTE_CACHE_TTL (default 1s). As with UCX_IB_AH_CACHE_TTL, inf never expires cached results and 0 disables the cache.

Why?


ucs_netlink_route_get() kept UCS_OK and UCS_ERR_UNREACHABLE results for the lifetime of the process. A process that once got UNREACHABLE kept failing ucp_ep_create() after the route was added back, while a newly started process connected. Likewise, a cached UCS_OK survived deletion of the route. A long-lived process could therefore not fail over to a path that came back without restarting.

How?


  • Each cache entry records the time of its lookup, and the kernel is queried again once the entry is older than the TTL. The cache still avoids a netlink round trip for the repeated reachability checks done during wireup.

  • With a TTL of 0, the lookup goes to the kernel directly, without using the cache.

  • When the kernel answers that there is no route, including a prohibit route (EACCES), the answer is cached as UCS_ERR_UNREACHABLE for the TTL. When a lookup gets no answer, e.g. because no netlink socket can be created, the previous result is kept and the lookup is done again at the next call. Other kernel errors are not cached.

  • Netlink requests return UCS_ERR_NO_RESOURCE when they cannot be sent or their reply cannot be received, to tell them apart from kernel error replies, which remain UCS_ERR_IO_ERROR.

  • The option is a UCS global option, since the cache is in UCS and not specific to RoCE. It is stored in seconds, as global options are parsed before the CPU clock is initialized.

  • test_netlink_route_cache.route_change adds and deletes a route in an unprivileged user and network namespace, and skips where user namespaces are not available, e.g. in CI containers. test_netlink_route_cache.failed_lookup needs no privileges: it limits the open files of a child process so that lookups fail, and checks that cached results are kept and that a TTL of 0 bypasses the cache.

  • gtest now checks the status of setting GTEST_LOG_LEVEL, which Coverity reports since this PR adds a checked call of ucs_global_opts_set_value().
  • Diff: 283 lines (+212 / -71) across 3 files Reviewer: tvegas1 Review duration: 6336m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.40) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 283 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.338
    Real PR Conversation Timeline
    1 comments
    "Review active on #12424"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.7% (MEDIUM) · Higher = larger blast radius
    39.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 21.2% · Safe to merge
    21.2%
    Repository