From owner-freebsd-arch@FreeBSD.ORG Wed Jan 8 18:59:18 2014 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 93777824; Wed, 8 Jan 2014 18:59:18 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F105316AF; Wed, 8 Jan 2014 18:59:17 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id s08IxC6F033504; Wed, 8 Jan 2014 20:59:12 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua s08IxC6F033504 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id s08IxC8c033503; Wed, 8 Jan 2014 20:59:12 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 8 Jan 2014 20:59:12 +0200 From: Konstantin Belousov To: Andriy Gapon Subject: Re: Acquiring a lock on the same CPU that holds it - what can be done? Message-ID: <20140108185912.GU59496@kib.kiev.ua> References: <52CD7D07.2010608@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BrbyRrLlz6sbpz/w" Content-Disposition: inline In-Reply-To: <52CD7D07.2010608@FreeBSD.org> User-Agent: Mutt/1.5.22 (2013-10-16) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: Adrian Chadd , "freebsd-arch@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jan 2014 18:59:18 -0000 --BrbyRrLlz6sbpz/w Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 08, 2014 at 06:29:59PM +0200, Andriy Gapon wrote: >=20 > I am sure that the following approach was suggested before, but I can not= find > any references now. > So, the idea is to auto-associate a priority with a lock. Every time a p= riority > lending would kick in we would record the priority in the lock. The next= time a > thread with a lower priority acquires that lock we would automatically bo= ost the > thread to the recorded priority until it releases the lock. This should = prevent > the situation that you've described where a higher priority thread preemp= ts a > lower priority thread just to discover that it holds a required lock and > priority lending is required before relinquishing a CPU to the preempted = thread. Isn't this exactly the mechanism offered by turnstiles, and used by non-sleepable locks ? >=20 > I am sure that there could be downsides to this approach. > --=20 > Andriy Gapon > _______________________________________________ > freebsd-arch@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org" --BrbyRrLlz6sbpz/w Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJSzZ//AAoJEJDCuSvBvK1BRJoP/3bsg5yJXSPTSyZpK1NE8usg pQXKqrt8qOkFJhm20XLE+35w7OYqIa4dsCDYch87Ite1jwn+r2zUEUSMxnJV/N2P 626dUPXws+sWXLmVG2bQAsLvEDzKuGI5HM5vRGWxi6/viYlJs9BkaC/lqaMK459s JdlDtKvYCOU7g2DJoLk5u6nId2RTq/+ahvGXvpTzFNTRN+GRd5ZUwuHVFqRyRTUS RrVcEN9D43lY2SLjtzAWaUNNLQ6QhLTStlQJQ7cCoU0/uC+q4zdPZnEu2cqR7dhD 4fInSHcDGyJC6nnl2jU0/KL9xTEFrvQrQLvBUD8TsztZDbI/qcFWneMgUgbfRAXI cINUon/shmL0Jvfz+m9eASWAx8r7hq6XS3yfSlAFHGVRSh3XTafvuRZxmAC8O/oZ Pihqf86RgsoZORe+N0JNGuDZ2Th5RzQqPIP7fgvckXSsZu94z/m4zpv2lcw1K1AL m8QLiWLpxGH0/FyRZfLzrdoIIeZrFcyVIc7SHDr3SFt1I9Gs+XoO99IaavZ24gj5 D6imJTgSYYA8jNKx7fyJRF9jycRtfOjOz417pQOzUxD7lJ7aDQnONEPMfVexg43s jJi2il/TkIZFb/0bBOq1DVhgwG5WCy6CxbejFD4ekTF6nJQeiDPdYQMBgk3nT/Eq 536pSHpjr6Q+fM1ulIOg =LvAL -----END PGP SIGNATURE----- --BrbyRrLlz6sbpz/w--