From owner-freebsd-arch@FreeBSD.ORG Tue Aug 15 23:31:07 2006 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DCB8616A4DD for ; Tue, 15 Aug 2006 23:31:07 +0000 (UTC) (envelope-from uucp@brian.han.de) Received: from baghira.han.de (baghira.han.de [62.48.90.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 414A243D45 for ; Tue, 15 Aug 2006 23:31:06 +0000 (GMT) (envelope-from uucp@brian.han.de) Received: by baghira.han.de (Postfix, from userid 10) id D61F6CDA23; Wed, 16 Aug 2006 01:31:02 +0200 (MEST) Received: (qmail 13245 invoked by uid 10); 16 Aug 2006 01:21:35 -0000 MBOX-Line: From owner-freebsd-current@freebsd.org Mon Aug 14 21:04:34 2006 Received: from mx2.freebsd.org (mx2.freebsd.org [216.136.204.119]) by baghira.han.de (Postfix) with ESMTP id 66A92CD841 for ; Mon, 14 Aug 2006 21:04:34 +0200 (MEST) Received: from hub.freebsd.org (hub.freebsd.org [216.136.204.18]) by mx2.freebsd.org (Postfix) with ESMTP id A95199210C; Mon, 14 Aug 2006 19:01:31 +0000 (GMT) (envelope-from owner-freebsd-current@freebsd.org) Received: from hub.freebsd.org (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 7623B16A4E1; Mon, 14 Aug 2006 19:01:07 +0000 (UTC) (envelope-from owner-freebsd-current@freebsd.org) X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7BD8A16A4DE for ; Mon, 14 Aug 2006 19:01:01 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id B8EBB43D77 for ; Mon, 14 Aug 2006 19:00:55 +0000 (GMT) (envelope-from asmrookie@gmail.com) Received: by wx-out-0506.google.com with SMTP id i27so425033wxd for ; Mon, 14 Aug 2006 12:00:55 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=KYK+GHXCaaHNdB+sl9Q7cYZGCaqFd1osu6uR+0TaRpD93AZPsHYVrH8bt05woKCWeMPdUvxZRa1JkXW6b7sd1xQhI7UO2FCU79WnSFk/ySP33A7rnV6hbG9U68tXlqYGYHUF/xKSx6Ldh13XOH6Zp3M+6+7J0aYRFq9hNhIuRW0= Received: by 10.70.109.4 with SMTP id h4mr4386796wxc; Mon, 14 Aug 2006 12:00:55 -0700 (PDT) Received: by 10.70.11.4 with HTTP; Mon, 14 Aug 2006 12:00:54 -0700 (PDT) Message-ID: <3bbf2fe10608141200v51d370cajfde0fd94cf92aac@mail.gmail.com> Date: Mon, 14 Aug 2006 21:00:54 +0200 From: "Attilio Rao" To: freebsd-arch@freebsd.org, freebsd-current@freebsd.org, "John Baldwin" In-Reply-To: <3bbf2fe10608071227j17c4cfa6qd84e1d8e53668fda@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <3bbf2fe10608071227j17c4cfa6qd84e1d8e53668fda@mail.gmail.com> X-Google-Sender-Auth: bc1bd3c96aead14f X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Sender: owner-freebsd-current@freebsd.org Errors-To: owner-freebsd-current@freebsd.org Cc: Subject: Re: [PATCH] Adding Solaris-style "owner of records" to rwlocks X-BeenThere: freebsd-arch@freebsd.org List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2006 23:31:08 -0000 2006/8/7, Attilio Rao : > This is a first implementation of the owner of records concept in rwlocks. > It allows to avoid the priority inversion problem in the current > rwlocks implementation (for readers). > > The main idea (that John and I discussed) is to have as owner of > records the first rlock'er for a "class contention". > The implementation consists in adding two flags (RW_LOCK_OWNED and > RW_LOCK_EXEMPTED) which are used in order to not penalyze the easy > case, and syncronizing the operation of acquiring and dropping the > owner of records with the turnstile spin-lock. > The main scheme might work in this way: > > thread1::rlock() -> sets the owner of records > thread2::rlock() -> checks for RW_LOCK_OWNED bit and, if it is set, go > in the easy case > thread3::rlock() -> checks for RW_LOCK_OWNED... > thread4::wlock() -> blocks and land its priority to thread1 > thread1::runlock() -> disable the owner of records (disowning the > associated turnstile) and sets the RW_LOCK_EXEMPTED flag. In this way > other threads will treact as an easy case. > ... > > What I actually need is a testing suite for heavy-load contentions, > since I would like to detect eventual races I missed, etc. If somebody > has a get-ready testing suite, please, let me know. > > The patch against HEAD is here: > http://users.gufi.org/~rookie/works/patches/rwlocks.diff > > Please, this is not intended to be a final implementation for this, > since I think that it can be improved; it is just a starting point for > ongoing works and improvements. I cleaned a lot the code, added some extra debug stubs and comments and get rid of RW_LOCK_EXEMPTED bit. Please refer to: http://users.gufi.org/~rookie/works/patches/rwlocks2.diff in order to make tests and comments. Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein _______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"