From owner-svn-src-head@freebsd.org Sat Oct 14 00:30:54 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C0A8E311C0 for ; Sat, 14 Oct 2017 00:30:54 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 42A067E9DC for ; Sat, 14 Oct 2017 00:30:53 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: d8281d00-b076-11e7-b50b-53dc5ecda239 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound2.ore.mailhop.org (Halon) with ESMTPSA id d8281d00-b076-11e7-b50b-53dc5ecda239; Sat, 14 Oct 2017 00:30:14 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v9E0Uok2002286; Fri, 13 Oct 2017 18:30:50 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1507941050.8386.88.camel@freebsd.org> Subject: Re: svn commit: r324609 - head/sys/sys From: Ian Lepore To: Svatopluk Kraus , Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 13 Oct 2017 18:30:50 -0600 In-Reply-To: References: <201710132031.v9DKVueS089009@repo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Oct 2017 00:30:54 -0000 On Fri, 2017-10-13 at 23:38 +0200, Svatopluk Kraus wrote: > MTX_UNOWNED is a flag. You did not change its value from 4 to 0, you > removed it actually. I have very bad feeling about it. But maybe, it's > really possible and in that case, a very good explanation should be > provided. > > Svata > The part that scares me is that DESTROYED may have been defined as CONTESTED|UNOWNED for subtle and clever reasons lost in the mists of time.  Any of the places that are testing the MTX_CONTESTED bit may have been relying somehow on the fact that a destroyed mutex has that bit set. Then again, maybe Mateusz has carefully analyzed all this stuff, and we should just relax. :) -- Ian > > On Fri, Oct 13, 2017 at 10:31 PM, Mateusz Guzik > wrote: > > > > Author: mjg > > Date: Fri Oct 13 20:31:56 2017 > > New Revision: 324609 > > URL: https://svnweb.freebsd.org/changeset/base/324609 > > > > Log: > >   mtx: change MTX_UNOWNED from 4 to 0 > > > >   The value is spread all over the kernel and zeroing a register is > >   cheaper/shorter than setting it up to an arbitrary value. > > > >   Reduces amd64 GENERIC-NODEBUG .text size by 0.4%. > > > >   MFC after:    1 week > > > > Modified: > >   head/sys/sys/mutex.h > > > > Modified: head/sys/sys/mutex.h > > =================================================================== > > =========== > > --- head/sys/sys/mutex.h        Fri Oct 13 20:29:35 > > 2017        (r324608) > > +++ head/sys/sys/mutex.h        Fri Oct 13 20:31:56 > > 2017        (r324609) > > @@ -65,15 +65,11 @@ > >   * State bits kept in mutex->mtx_lock, for the DEFAULT lock type. > > None of this, > >   * with the exception of MTX_UNOWNED, applies to spin locks. > >   */ > > +#define        MTX_UNOWNED     0x00000000      /* Cookie for free > > mutex */ > >  #define        MTX_RECURSED    0x00000001      /* lock recursed > > (for MTX_DEF only) */ > >  #define        MTX_CONTESTED   0x00000002      /* lock contested > > (for MTX_DEF only) */ > > -#define MTX_UNOWNED    0x00000004      /* Cookie for free mutex */ > > -#define        MTX_FLAGMASK    (MTX_RECURSED | MTX_CONTESTED | > > MTX_UNOWNED) > > - > > -/* > > - * Value stored in mutex->mtx_lock to denote a destroyed mutex. > > - */ > > -#define        MTX_DESTROYED   (MTX_CONTESTED | MTX_UNOWNED) > > +#define        MTX_DESTROYED   0x00000004      /* lock destroyed > > */ > > +#define        MTX_FLAGMASK    (MTX_RECURSED | MTX_CONTESTED | > > MTX_DESTROYED) > > > >  /* > >   * Prototypes > >