Re: [PATCH rdma-next 1/8] RDMA/core: Add rdma_restrack_begin/abort/commit_del() operations
From: Edward Srouji
Date: Thu Jul 09 2026 - 14:02:57 EST
On 7/2/2026 8:46 PM, Jason Gunthorpe wrote:
External email: Use caution opening links or attachments
On Wed, Jul 01, 2026 at 03:28:15PM +0300, Edward Srouji wrote:
+static void restrack_drain_res(struct rdma_restrack_root *rt,
+ struct rdma_restrack_entry *res)
+{
+ struct rdma_restrack_entry *old;
+
+ old = xa_cmpxchg(&rt->xa, res->id, res, XA_ZERO_ENTRY, GFP_KERNEL);
+ WARN_ON(old != res);
+
+ rdma_restrack_put(res);
+ wait_for_completion(&res->comp);
+}
+ */
+void rdma_restrack_begin_del(struct rdma_restrack_entry *res)
+{
+ struct rdma_restrack_root *rt;
+
+ if (!res->valid)
+ return;
+
+ if (res->no_track) {
+ rdma_restrack_put(res);
+ wait_for_completion(&res->comp);
+ return;
+ }
+
+ rt = res_to_rt(res);
+ if (!rt)
+ return;
+
+ restrack_drain_res(rt, res);
Why the duplicatin of the put and wait? Maybe
restrack_drain_res(NULL, res)
should just skip the xa part? Same for the other functions.
Jason
NP, I think they can be easily squashed within the drain() and restore() functions.
I'll send a V2 soon, sorry for the delayed response.