[PATCH v2] nvmet: drop the extra RCU grace period in nvmet_ns_disable()

Keith Busch kbusch at kernel.org
Wed Nov 4 08:35:11 PST 2026


On Wed, Nov 04, 2026 at 01:31:28AM -0500, Qiliang Yuan wrote:
> nvmet_ns_disable() kills the namespace's percpu ref, waits in
> synchronize_rcu() for anyone looking the namespace up under
> rcu_read_lock(), and then waits for the ref to drop to zero.
> 
> Killing a percpu ref that is still in percpu mode, as the namespace
> ref always is until then, switches it to atomic mode from an RCU
> callback, so the ref can't drop to zero before a grace period has
> passed since the kill. synchronize_rcu() thus adds a second grace
> period in a row, about 4 ms here, and disabling the namespaces of a
> subsystem one by one takes about 9 ms each.
> 
> Drop synchronize_rcu() and rely on the wait for the ref to cover the
> RCU readers as well.

Thanks, applied to nvme-7.4.



More information about the Linux-nvme mailing list