Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Mar 2015 21:44:39 -0700
From:      Mark Johnston <markj@FreeBSD.org>
To:        Davide Italiano <davide@freebsd.org>
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>, Tiwei Bie <btw@mail.ustc.edu.cn>, Mateusz Guzik <mjguzik@gmail.com>, Ryan Stone <rysto32@gmail.com>, wca@freebsd.org
Subject:   Re: [PATCH] Finish the task 'Convert mountlist_mtx to rwlock'
Message-ID:  <20150312044439.GB11120@raichu>
In-Reply-To: <CACYV=-H%2BE4knx7DwaKv4qtg5xnG7bKE_E2aygYUocGtwKKqKOg@mail.gmail.com>
References:  <1426079434-51568-1-git-send-email-btw@mail.ustc.edu.cn> <CAFMmRNyLJgLuk-VPSuyBCpO1bkdmyGf3s89X-An1vCCMwn=B=A@mail.gmail.com> <CACYV=-H%2BE4knx7DwaKv4qtg5xnG7bKE_E2aygYUocGtwKKqKOg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 11, 2015 at 09:14:49PM -0700, Davide Italiano wrote:
> On Wed, Mar 11, 2015 at 9:06 PM, Ryan Stone <rysto32@gmail.com> wrote:
> > On Wed, Mar 11, 2015 at 9:10 AM, Tiwei Bie <btw@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:
> >
> 
> Snippet:
> [...]
> -                       mtx_unlock(&mountlist_mtx);
> +                       rw_runlock(&mountlist_lock);
>                 mp->mnt_kern_flag |= MNTK_MWAIT;
>                 msleep(mp, MNT_MTX(mp), PVFS | PDROP, "vfs_busy", 0);
>                 if (flags & MBF_MNTLSTLOCK)
> -                       mtx_lock(&mountlist_mtx);
> +                       rw_rlock(&mountlist_lock);
> [...]
> 
> My understanding is that readers are not allowed to sleep while
> holding an rmlock() so a drop-in replacement don't work in this case.

That's true of an rwlock as well though. And the mountlist lock is
dropped around the msleep call in this snippet.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150312044439.GB11120>