Date: Sun, 2 Nov 2014 18:59:06 +0100 From: Attilio Rao <attilio@freebsd.org> To: Konstantin Belousov <kostikbel@gmail.com> Cc: "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org> Subject: Re: svn commit: r273966 - in head: share/man/man9 sys/kern sys/sys Message-ID: <CAJ-FndCeQ2gSQYG5CsU0=SNR_2A9pcLpb0CgVB4vACZ9zp_ufQ@mail.gmail.com> In-Reply-To: <CAJ-FndC_3Te6Y7N0%2B8ZddH8i72cxH%2BACHm=EShHp=QDoX4xSow@mail.gmail.com> References: <201411021310.sA2DAWmD003298@svn.freebsd.org> <CAJ-FndB5%2BhhHprTiV1ODJoE9RNZLtOe2eQDi3MEpgPKYbM3LAw@mail.gmail.com> <20141102163728.GX53947@kib.kiev.ua> <CAJ-FndAeh_i9F98Tq-ZXgX%2Badq4mOgoadSoYJ6hmvYpBtmkvow@mail.gmail.com> <20141102165916.GY53947@kib.kiev.ua> <CAJ-FndAbhBFQ1gD64Wi210zH-0kfxjkkUJRNYHnFnmW%2BKAhm2w@mail.gmail.com> <20141102174958.GZ53947@kib.kiev.ua> <CAJ-FndC_3Te6Y7N0%2B8ZddH8i72cxH%2BACHm=EShHp=QDoX4xSow@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Nov 2, 2014 at 6:53 PM, Attilio Rao <attilio@freebsd.org> wrote: > On Sun, Nov 2, 2014 at 6:49 PM, Konstantin Belousov <kostikbel@gmail.com> wrote: >> On Sun, Nov 02, 2014 at 06:07:20PM +0100, Attilio Rao wrote: >>> On Sun, Nov 2, 2014 at 5:59 PM, Konstantin Belousov <kostikbel@gmail.com> wrote: >>> > It is easy and cheap to record the set of the owned lockmgr locks for >>> > current thread. I do not believe that we have a situation where more >>> > than 3 locks are held in one time. To give it some slack, we can record >>> > 8 locks shared-owned and do the check for recursion in LK_CAN_SHARE(). >>> > If the thread-locks table overflows, we could either panic() or fall >>> > back to indiscriminative deadlock avoidance (i.e. relying on the sole >>> > td_lk_slocks value). >>> >>> I don't think it is going to be cheap (and certainly it is not viable >>> for things like sx locks and rwlocks). >> sx and rw do not implement exclusive starvation avoidance. > > rw do. > It is believed for sx it should not be too helpful, on FreeBSD I've > never seen an sx that is particulary congested. > It can be added, however and the algorithm they would use is the same than rw. > >>> Checking for the owner chain anytime you acquire the lock is certainly >>> not I would call cheap. >> >> I did not proposed to verify owner chain. I said that it is easy to >> record the locks owned by current thread, only for current thread >> consumption. Below is the prototype. > > I think it is too expensive, think that this must happen for every shared lock. > I know we may not be using too many shared locks on lockmgr right now, > but it is not a good reason to make shared lock bloated and more > expensive on lockmgr. And to be honest, I find already wrong the fact that we don't have a faster path for lockmgr() (ie. inlined atomics). I think this sloppiness (at least on my side) cames on the fact that locking overhead is not a major factor for the performance of current lockmgr users. That doesn't mean, however, that we should have a slower primitive. Attilio -- Peace can only be achieved by understanding - A. Einstein
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-FndCeQ2gSQYG5CsU0=SNR_2A9pcLpb0CgVB4vACZ9zp_ufQ>