On Fri, Nov 30, 2018 at 11:04:07AM +0800, oulijun wrote: > 在 2018/11/30 8:06, Jason Gunthorpe 写道: > > On Sat, Nov 24, 2018 at 04:49:20PM +0800, Lijun Ou wrote: > > > >> diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c > >> new file mode 100644 > >> index 0000000..d8a8613 > >> +++ b/drivers/infiniband/hw/hns/hns_roce_srq.c > >> @@ -0,0 +1,26 @@ > >> +// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB > >> +/* > >> + * Copyright (c) 2018 Hisilicon Limited. > >> + */ > >> + > >> +#include <rdma/ib_umem.h> > >> +#include <rdma/hns-abi.h> > >> +#include "hns_roce_device.h" > >> +#include "hns_roce_cmd.h" > >> +#include "hns_roce_hem.h" > >> + > >> +int hns_roce_init_srq_table(struct hns_roce_dev *hr_dev) > >> +{ > >> + struct hns_roce_srq_table *srq_table = &hr_dev->srq_table; > >> + > >> + xa_init(&srq_table->xa); > > Is a call to xa_destroy missing? > > > > Jason > Hi, Jason > It uses xarray instead radix tree. the orign code as follows: > spin_lock_int(&srq_table->lock); > INIT_RADIX_TREE(&srq_table->tree, GFP_ATOMIC); > > So, we should use xa_init instead of it. I think that it should not use xa_destroy. Well, radix tree didn't have a destroy, it was considered destroyed when empty, while xarray does have a destroy. Seems reasonable to call it even if you know the xarray is empty? Matthew? Jason