[PATCH V3 02/10] nvme-core: use xarray for ctrl ns tracking
Keith Busch
kbusch at kernel.org
Tue Jul 14 21:41:51 EDT 2020
On Wed, Jul 15, 2020 at 02:33:42AM +0100, Matthew Wilcox wrote:
> On Tue, Jul 14, 2020 at 05:55:09PM -0700, Keith Busch wrote:
> > On Tue, Jul 14, 2020 at 04:30:49PM -0700, Chaitanya Kulkarni wrote:
> > > @@ -3933,9 +3918,7 @@ static void nvme_ns_remove(struct nvme_ns *ns)
> > > blk_integrity_unregister(ns->disk);
> > > }
> > >
> > > - down_write(&ns->ctrl->namespaces_rwsem);
> > > - list_del_init(&ns->list);
> > > - up_write(&ns->ctrl->namespaces_rwsem);
> > > + xa_erase(xa, ns->head->ns_id);
> >
> > Since you're using rcu to protect the kref_get() on load, we need a
> > synchronize_rcu() after removing it from the xarray.
>
> No, synchronize_rcu() is expensive. We should instead use call_rcu()
> to free the ns once the refcount hits zero.
Yeah, that is an even better option, though namespace removal is so
infrequent that cost isn't really a concern: this function already calls
synchronize_rcu() and syncronize_srcu().
More information about the Linux-nvme
mailing list