From: Jason Gunthorpe <jgg-uk2M96/98Pc@public.gmane.org>
To: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
RDMA mailing list
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Mark Bloch <markb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Steve Wise
<swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
Subject: Re: [PATCH rdma-next v5 3/8] RDMA/restrack: Add general infrastructure to track RDMA resources
Date: Tue, 23 Jan 2018 15:00:07 -0700 [thread overview]
Message-ID: <20180123220007.GA16845@ziepe.ca> (raw)
In-Reply-To: <20180123183552.GW1393-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
On Tue, Jan 23, 2018 at 08:35:52PM +0200, Leon Romanovsky wrote:
> > Replace the rcu and the mutex with a simple rwlock.
>
> My initial proposal was SRCU per-res to protect data with rwlock
> per-type to protect lists.
I don't think SRCU per-res helps here. (and the memory overhead would
be shocking, IMHO).
And if the goal is to avoid starvation of destroy from the reader side
I don't think it helps, as you can seriously delay synchronize_srcu()
by hitting the read side regions to force grace period waits.
I think you need a bit more adventure:
// Read side - could be a rwlock
mutex_lock(ibdev->resource_lock)
cur = list_head;
cur->readers++;
mutex_unlock();
[.. do slow stuff, push into the netlink skb ...]
mutex_lock();
cur->readers--;
if (cur->readers == 0)
wakeup(ibdev->wq);
cur = cur->next
mutex_unlock();
// Destroy side
mutex_lock(ibdev->resource_lock)
wait_event_cmd(ibdev->wq, obj->readers == 0, mutex_unlock(), mutex_lock());
list_del(..);
mutex_unlock();
Which would lock each resource only while being used, and the destroy
will wait only if it conflicts with the ongoing read.
Getting the linked list processing to work properly with this kind of
locking is hard.. The manual wq linked to the lock seems like a
reasonable compromise.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-01-23 22:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-22 12:51 [PATCH rdma-next v5 0/8] RDMA resource tracking Leon Romanovsky
[not found] ` <20180122125119.26419-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-01-22 12:51 ` [PATCH rdma-next v5 1/8] RDMA/core: Print caller name instead of function name Leon Romanovsky
2018-01-22 12:51 ` [PATCH rdma-next v5 2/8] RDMA/core: Save kernel caller name in PD and CQ objects Leon Romanovsky
2018-01-22 12:51 ` [PATCH rdma-next v5 3/8] RDMA/restrack: Add general infrastructure to track RDMA resources Leon Romanovsky
[not found] ` <20180122125119.26419-4-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-01-23 17:54 ` Jason Gunthorpe
[not found] ` <20180123175433.GI30670-uk2M96/98Pc@public.gmane.org>
2018-01-23 17:58 ` Jason Gunthorpe
[not found] ` <20180123175848.GK30670-uk2M96/98Pc@public.gmane.org>
2018-01-23 18:35 ` Leon Romanovsky
[not found] ` <20180123183552.GW1393-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2018-01-23 22:00 ` Jason Gunthorpe [this message]
2018-01-23 18:31 ` Leon Romanovsky
2018-01-22 12:51 ` [PATCH rdma-next v5 4/8] RDMA/core: Add resource tracking for create and destroy QPs Leon Romanovsky
2018-01-22 12:51 ` [PATCH rdma-next v5 5/8] RDMA/core: Add resource tracking for create and destroy CQs Leon Romanovsky
2018-01-22 12:51 ` [PATCH rdma-next v5 6/8] RDMA/core: Add resource tracking for create and destroy PDs Leon Romanovsky
2018-01-22 12:51 ` [PATCH rdma-next v5 7/8] RDMA/nldev: Provide global resource utilization Leon Romanovsky
2018-01-22 12:51 ` [PATCH rdma-next v5 8/8] RDMA/nldev: Provide detailed QP information Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180123220007.GA16845@ziepe.ca \
--to=jgg-uk2m96/98pc@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=markb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox