Date: Wed, 11 Mar 2015 21:14:49 -0700 From: Davide Italiano <davide@freebsd.org> To: Ryan Stone <rysto32@gmail.com> Cc: "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>, Tiwei Bie <btw@mail.ustc.edu.cn>, Mateusz Guzik <mjguzik@gmail.com>, wca@freebsd.org Subject: Re: [PATCH] Finish the task 'Convert mountlist_mtx to rwlock' Message-ID: <CACYV=-H%2BE4knx7DwaKv4qtg5xnG7bKE_E2aygYUocGtwKKqKOg@mail.gmail.com> In-Reply-To: <CAFMmRNyLJgLuk-VPSuyBCpO1bkdmyGf3s89X-An1vCCMwn=B=A@mail.gmail.com> References: <1426079434-51568-1-git-send-email-btw@mail.ustc.edu.cn> <CAFMmRNyLJgLuk-VPSuyBCpO1bkdmyGf3s89X-An1vCCMwn=B=A@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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. -- Davide "There are no solved problems; there are only problems that are more or less solved" -- Henri Poincare
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACYV=-H%2BE4knx7DwaKv4qtg5xnG7bKE_E2aygYUocGtwKKqKOg>