Skip to content

rcu: a per-table choice between RCU and SRCU for the walk, decided by a number #1184

Open

Description

@lneto

rcu.map walks inside an SRCU read-side critical section since #1179, so its callback may sleep and every entry a writer unlinks goes through call_srcu before kfree_rcu. Measured on the shared host (aarch64, three runs of a million operations each, minimum ns per operation, with a spread between runs of 110 to 172 on master alone): a replace costs 110 on master and 113 on #1179, an insert and remove pair 134 and 145, and a walk 164 and 146 per key visited. The difference between call_srcu and kfree_rcu on the writer sits inside the noise, the walk got cheaper, and lookups are untouched. Not measured: memory in flight, since an unlinked entry now lives an SRCU grace period, tens of ms, plus an RCU one, instead of one.

A table walked only from interrupt-context runtimes, whose callback cannot sleep anyway, could keep the walk under rcu_read_lock and free with kfree_rcu alone. The choice is per table and not per call, since the writer decides how it frees, and it costs a flag at creation, two walk paths, a refusal of the sleeping walker and its documentation; the tables written hot in the tree, systrack's, are walked from process context and would stay SRCU. Not done now: open it when a consumer shows a hot-writer table walked only from hooks, with that table's number in hand.

Activity

  1. added
    severity: lowDocumentation, tests or cleanup
    complexity: largeNeeds design, several pull requests or an architectural decision
    on Sep 26, 2026
  2. added this to the backlog milestone on Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity: largeNeeds design, several pull requests or an architectural decisionseverity: lowDocumentation, tests or cleanup

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions