> -----Original Message----- > From: linux-rdma-owner@xxxxxxxxxxxxxxx [mailto:linux-rdma- > owner@xxxxxxxxxxxxxxx] On Behalf Of Leon Romanovsky > Sent: Monday, April 02, 2018 11:52 PM > To: Doug Ledford <dledford@xxxxxxxxxx>; Jason Gunthorpe > <jgg@xxxxxxxxxxxx> > Cc: Leon Romanovsky <leonro@xxxxxxxxxxxx>; RDMA mailing list <linux- > rdma@xxxxxxxxxxxxxxx> > Subject: [PATCH rdma-rc 1/3] RDMA/rdma_cm: Remove process_req and timer > sorting > > From: Jason Gunthorpe <jgg@xxxxxxxxxxxx> > > Now that the work queue is used directly to launch and track the work there is > no need for the second processing function to do 'all list entries'. Just schedule > all entries onto the main work queue directly. > > We can also drop all of the useless list sorting now, as the workqueue sorts by > expiration time automatically. > > This change requires switching lock to a spinlock as netdev notifiers are called in > an atomic context, this is now easy since the lock does not need to be held > across the lookup, that is already single threaded due to the work queue. > > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx> > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx> > --- > drivers/infiniband/core/addr.c | 96 +++++++++++------------------------------- > 1 file changed, 25 insertions(+), 71 deletions(-) > > diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index > cb1d2ab13c66..c7e8cfb5689c 100644 > --- a/drivers/infiniband/core/addr.c > +++ b/drivers/infiniband/core/addr.c > @@ -68,11 +68,8 @@ struct addr_req { > > static atomic_t ib_nl_addr_request_seq = ATOMIC_INIT(0); > > -static void process_req(struct work_struct *work); > - > -static DEFINE_MUTEX(lock); > +static DEFINE_SPINLOCK(lock); > static LIST_HEAD(req_list); > -static DECLARE_DELAYED_WORK(work, process_req); static struct > workqueue_struct *addr_wq; > > static const struct nla_policy ib_nl_addr_policy[LS_NLA_TYPE_MAX] = { @@ - > 112,7 +109,7 @@ static void ib_nl_process_good_ip_rsep(const struct nlmsghdr > *nlh) > memcpy(&gid, nla_data(curr), nla_len(curr)); > } > > - mutex_lock(&lock); > + spin_lock_bh(&lock); > list_for_each_entry(req, &req_list, list) { > if (nlh->nlmsg_seq != req->seq) > continue; > @@ -122,7 +119,7 @@ static void ib_nl_process_good_ip_rsep(const struct > nlmsghdr *nlh) > found = 1; > break; > } > - mutex_unlock(&lock); > + spin_unlock_bh(&lock); > > if (!found) > pr_info("Couldn't find request waiting for DGID: %pI6\n", @@ - > 302,7 +299,7 @@ int rdma_translate_ip(const struct sockaddr *addr, } > EXPORT_SYMBOL(rdma_translate_ip); > > -static void set_timeout(struct delayed_work *delayed_work, unsigned long > time) > +static void set_timeout(struct addr_req *req, unsigned long time) > { set_timeout() works on the delayed work structure before and in this patch. So change likely is not necessary, but it doesn't hurt, if you think this brings code clarity. [..] Reviewed-by: Parav Pandit <parav@xxxxxxxxxxxx> -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html