[PATCH] Finish the task 'Convert mountlist_mtx to rwlock'
Ryan Stone
rysto32 at gmail.com
Thu Mar 12 04:06:03 UTC 2015
On Wed, Mar 11, 2015 at 9:10 AM, Tiwei Bie <btw at mail.ustc.edu.cn> wrote:
> Hi, Mateusz!
>
> I have finished the task: Convert mountlist_mtx to rwlock [1].
My first comment is, are we sure that we actually want an rwlock here
instead of an rmlock? An rmlock will offer much better performance in
workloads that mostly only take read locks, and rmlocks do not suffer
the priority inversion problems that rwlocks do. From the description
on the wiki page, it sounds like an rmlock would be ideal here:
> Interested person can upgrade this task to non-junior by coming up with a
> solution exploiting rare need to modify the list. Example approaches include
> designing a locking primitive with cheap shared locking (think: per-cpu) at
> the expense of exclusive locking.
The rmlock primitive does exactly this optimization. See the manpage
for the API (it's mostly very similar to the rwlock API):
https://www.freebsd.org/cgi/man.cgi?query=rmlock&apropos=0&sektion=0&manpath=FreeBSD+10.1-RELEASE&arch=default&format=html
> void zfs_mountlist_wlock(void);
> void zfs_mountlist_wunlock(void);
> void zfs_mountlist_rlock(void);
> void zfs_mountlist_runlock(void);
Why not:
#define zfs_mountlist_wlock() _zfs_mountlist_wlock(__FILE__, __LINE__)
void _zfs_mountlist_wlock(const char *file, int line);
/* etc, etc */
(This may be moot if we switch to an rmlock though)
More information about the freebsd-hackers
mailing list