[PATCH V3 02/10] nvme-core: use xarray for ctrl ns tracking
Matthew Wilcox
willy at infradead.org
Tue Jul 14 21:33:42 EDT 2020
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.
More information about the Linux-nvme
mailing list