Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178047092
D60405.1795844405.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D60405.1795844405.diff
View Options
diff --git a/sys/ofed/drivers/infiniband/core/ib_rdma_core.c b/sys/ofed/drivers/infiniband/core/ib_rdma_core.c
--- a/sys/ofed/drivers/infiniband/core/ib_rdma_core.c
+++ b/sys/ofed/drivers/infiniband/core/ib_rdma_core.c
@@ -295,13 +295,29 @@
static int idr_add_uobj(struct ib_uobject *uobj)
{
- /*
- * We start with allocating an idr pointing to NULL. This represents an
- * object which isn't initialized yet. We'll replace it later on with
- * the real object once we commit.
- */
- return xa_alloc(&uobj->ufile->idr, &uobj->id, NULL, xa_limit_32b,
- GFP_KERNEL);
+ struct ib_uverbs_file *ufile = uobj->ufile;
+ u32 id, start;
+ int ret;
+
+ xa_lock(&ufile->idr);
+ start = ufile->idr_next;
+ id = start;
+ do {
+ ret = __xa_insert(&ufile->idr, id, NULL, GFP_KERNEL);
+ if (ret != -EEXIST)
+ break;
+ id++;
+ } while (id != start);
+
+ if (!ret) {
+ uobj->id = id;
+ ufile->idr_next = id + 1;
+ } else if (ret == -EEXIST) {
+ ret = -ENOMEM;
+ }
+ xa_unlock(&ufile->idr);
+
+ return ret;
}
/* Returns the ib_uobject or an error. The caller should check for IS_ERR. */
diff --git a/sys/ofed/drivers/infiniband/core/uverbs.h b/sys/ofed/drivers/infiniband/core/uverbs.h
--- a/sys/ofed/drivers/infiniband/core/uverbs.h
+++ b/sys/ofed/drivers/infiniband/core/uverbs.h
@@ -163,6 +163,7 @@
struct list_head umaps;
struct xarray idr;
+ u32 idr_next;
};
struct ib_uverbs_event {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 28, 5:40 AM (15 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42032557
Default Alt Text
D60405.1795844405.diff (1 KB)
Attached To
Mode
D60405: ibcore: Avoid quadratic uverbs ID allocation
Attached
Detach File
Event Timeline