Re: [RFC PATCH 05/12] rcu_txn: Add an hlist edited through transactions

From: Mathieu Desnoyers

Date: Tue Nov 10 2026 - 10:54:50 EST


On 2026-10-23 14:22, Puranjay Mohan wrote:
[...]
dcache relies on d_unhashed(), i.e. a NULL pprev, which __d_drop() sets.
Could the _rcu delete and replace clear pprev the way
hlist_del_init_rcu() does, and could there be an
rcu_txn_hlist_unhashed()? For the _prepare forms, del_prepare and
replace_prepare could record pprev -> NULL through
__rcu_txn_hlist_record_pprev().

Yes. Readers never load pprev, so clearing it is safe for them. What
you suggest is planned for the next version:

- The _rcu forms of delete and replace will set the removed node's
pprev to NULL.
- The _prepare forms will record pprev -> NULL. A cancel then leaves
the node as it was.
- rcu_txn_hlist_unhashed() will test the state.
rcu_txn_hlist_node_init() will initialize a node as unhashed.

A second delete will then fault on the NULL pprev, as hlist_del_rcu()
does on its poison. With CONFIG_DEBUG_RCU_TXN, an edit anchored on an
unhashed node will warn.

That costs at most one record, though a
lone delete or replace of a bucket's last node would no longer be a
one-record commit.

Yes. The samples will reserve five records for an unlink.

Thanks,

Mathieu


--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com