From owner-freebsd-arch@FreeBSD.ORG Mon Mar 8 11:06:56 2010 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2993410656B1 for ; Mon, 8 Mar 2010 11:06:56 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id CED9C8FC28 for ; Mon, 8 Mar 2010 11:06:52 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o28B6qp8073618 for ; Mon, 8 Mar 2010 11:06:52 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o28B6qaY073616 for freebsd-arch@FreeBSD.org; Mon, 8 Mar 2010 11:06:52 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 8 Mar 2010 11:06:52 GMT Message-Id: <201003081106.o28B6qaY073616@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-arch@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-arch@FreeBSD.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2010 11:06:56 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/120749 arch [request] Suggest upping the default kern.ps_arg_cache 1 problem total. From owner-freebsd-arch@FreeBSD.ORG Fri Mar 12 12:18:40 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB835106564A for ; Fri, 12 Mar 2010 12:18:40 +0000 (UTC) (envelope-from freebsd-arch@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id 875148FC1F for ; Fri, 12 Mar 2010 12:18:39 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Nq3p8-0006Tl-3h for freebsd-arch@freebsd.org; Fri, 12 Mar 2010 13:18:38 +0100 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 12 Mar 2010 13:18:38 +0100 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 12 Mar 2010 13:18:38 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-arch@freebsd.org From: Ivan Voras Date: Fri, 12 Mar 2010 13:18:29 +0100 Lines: 23 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.5) Gecko/20100118 Thunderbird/3.0 Subject: likely and unlikely X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2010 12:18:40 -0000 While looking into branch prediction in gcc I found this post describing the "likely" and "unlikely" macros in Linux: http://kerneltrap.org/node/4705 In short, they are wrappers for the gcc-specific __builtin_expect for static branch prediction. Grepping around I see it is defined and used locally in several places: amd64/include/xen/xen-os.h:#define likely(x) __builtin_expect((x),1) amd64/include/xen/xen-os.h:#define unlikely(x) __builtin_expect((x),0) dev/nxge/xge-osdep.h:#define xge_os_unlikely(x) (x) gnu/fs/xfs/FreeBSD/xfs_compat.h:#define likely(x) __builtin_expect((x), 1) gnu/fs/xfs/FreeBSD/xfs_compat.h:#define unlikely(x) __builtin_expect((x), 0) i386/include/xen/xen-os.h:#define likely(x) __builtin_expect((x),1) i386/include/xen/xen-os.h:#define unlikely(x) __builtin_expect((x),0) sun4v/include/cpu.h:#define likely(x) __builtin_expect((x),1) sun4v/include/cpu.h:#define unlikely(x) __builtin_expect((x),0) Wouldn't it be more convenient to have a single global definition of them, under #ifdef __GNUC__ for example in sys/stddef.h ? From owner-freebsd-arch@FreeBSD.ORG Fri Mar 12 12:26:24 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E576106566C; Fri, 12 Mar 2010 12:26:24 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 00D798FC0A; Fri, 12 Mar 2010 12:26:24 +0000 (UTC) Received: by palm.hoeg.nl (Postfix, from userid 1000) id CDAA41CC0C; Fri, 12 Mar 2010 13:26:09 +0100 (CET) Date: Fri, 12 Mar 2010 13:26:08 +0100 From: Ed Schouten To: Ivan Voras Message-ID: <20100312122559.GU8200@hoeg.nl> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7VPaMwFPs6f2AQNU" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-arch@freebsd.org Subject: Re: likely and unlikely X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2010 12:26:24 -0000 --7VPaMwFPs6f2AQNU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Ivan, * Ivan Voras wrote: > Wouldn't it be more convenient to have a single global definition of > them, under #ifdef __GNUC__ for example in sys/stddef.h ? Wouldn't it be better to have them in sys/cdefs.h? --=20 Ed Schouten WWW: http://80386.nl/ --7VPaMwFPs6f2AQNU Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkuaMtAACgkQ52SDGA2eCwU0+QCaAsJ2HIRPUeBn55b0h/Bra2DE cGgAmwS5MA5yOnaHLbqZtGmp3zkyTW9/ =MLnX -----END PGP SIGNATURE----- --7VPaMwFPs6f2AQNU-- From owner-freebsd-arch@FreeBSD.ORG Fri Mar 12 12:27:53 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25F8F1065670 for ; Fri, 12 Mar 2010 12:27:53 +0000 (UTC) (envelope-from freebsd-arch@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id D4F738FC12 for ; Fri, 12 Mar 2010 12:27:52 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Nq3y3-0003MF-To for freebsd-arch@freebsd.org; Fri, 12 Mar 2010 13:27:51 +0100 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 12 Mar 2010 13:27:51 +0100 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 12 Mar 2010 13:27:51 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-arch@freebsd.org From: Ivan Voras Date: Fri, 12 Mar 2010 13:27:38 +0100 Lines: 11 Message-ID: References: <20100312122559.GU8200@hoeg.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.5) Gecko/20100118 Thunderbird/3.0 In-Reply-To: <20100312122559.GU8200@hoeg.nl> Subject: Re: likely and unlikely X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2010 12:27:53 -0000 On 03/12/10 13:26, Ed Schouten wrote: > Hi Ivan, > > * Ivan Voras wrote: >> Wouldn't it be more convenient to have a single global definition of >> them, under #ifdef __GNUC__ for example in sys/stddef.h ? > > Wouldn't it be better to have them in sys/cdefs.h? Yes, I think you're right. From owner-freebsd-arch@FreeBSD.ORG Fri Mar 12 12:35:06 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02619106566B for ; Fri, 12 Mar 2010 12:35:06 +0000 (UTC) (envelope-from freebsd-arch@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id 3D7B58FC2A for ; Fri, 12 Mar 2010 12:35:05 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Nq451-00077y-ES for freebsd-arch@freebsd.org; Fri, 12 Mar 2010 13:35:03 +0100 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 12 Mar 2010 13:35:03 +0100 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 12 Mar 2010 13:35:03 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-arch@freebsd.org From: Ivan Voras Date: Fri, 12 Mar 2010 13:30:07 +0100 Lines: 25 Message-ID: References: <20100312122559.GU8200@hoeg.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.5) Gecko/20100118 Thunderbird/3.0 In-Reply-To: Subject: Re: likely and unlikely X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2010 12:35:06 -0000 On 03/12/10 13:27, Ivan Voras wrote: > On 03/12/10 13:26, Ed Schouten wrote: >> Hi Ivan, >> >> * Ivan Voras wrote: >>> Wouldn't it be more convenient to have a single global definition of >>> them, under #ifdef __GNUC__ for example in sys/stddef.h ? >> >> Wouldn't it be better to have them in sys/cdefs.h? > > Yes, I think you're right. Actually, it looks like it would be best to simply add them alongside __predict_true and __predict_False in sys/cdefs.h: 306 #if __GNUC_PREREQ__(2, 96) 307 #define __predict_true(exp) __builtin_expect((exp), 1) 308 #define __predict_false(exp) __builtin_expect((exp), 0) 309 #else 310 #define __predict_true(exp) (exp) 311 #define __predict_false(exp) (exp) 312 #endif (There is nothing wrong with __predict_true and __predict_false - they are just less convenient to type.) From owner-freebsd-arch@FreeBSD.ORG Fri Mar 12 12:41:37 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C77A1106566C; Fri, 12 Mar 2010 12:41:37 +0000 (UTC) (envelope-from matthew.fleming@isilon.com) Received: from seaxch09.isilon.com (seaxch09.isilon.com [74.85.160.25]) by mx1.freebsd.org (Postfix) with ESMTP id A93628FC30; Fri, 12 Mar 2010 12:41:37 +0000 (UTC) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Date: Fri, 12 Mar 2010 04:28:47 -0800 Message-ID: <06D5F9F6F655AD4C92E28B662F7F853E021D4D25@seaxch09.desktop.isilon.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: likely and unlikely Thread-Index: AcrB30WGBYVOgdA3T+KXiX6638ZTewAAEp/r References: <20100312122559.GU8200@hoeg.nl> From: "Matthew Fleming" To: "Ed Schouten" , "Ivan Voras" Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-arch@freebsd.org Subject: RE: likely and unlikely X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2010 12:41:37 -0000 > * Ivan Voras wrote: > > Wouldnt it be more convenient to have a single global definition of > > them, under ifdef __GNUC__ for example in sys/stddef.h ? >=20 > Wouldnt it be better to have them in sys/cdefs.h? ... which is where __predict_true and __predict_false already live. Cheers, matthew From owner-freebsd-arch@FreeBSD.ORG Fri Mar 12 12:46:49 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 590EB106564A for ; Fri, 12 Mar 2010 12:46:49 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id A0E628FC1C for ; Fri, 12 Mar 2010 12:46:48 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id OAA20586; Fri, 12 Mar 2010 14:30:52 +0200 (EET) (envelope-from avg@icyb.net.ua) Message-ID: <4B9A33FB.4020108@icyb.net.ua> Date: Fri, 12 Mar 2010 14:30:51 +0200 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.23 (X11/20100211) MIME-Version: 1.0 To: Ivan Voras References: In-Reply-To: X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: freebsd-arch@freebsd.org Subject: Re: likely and unlikely X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2010 12:46:49 -0000 on 12/03/2010 14:18 Ivan Voras said the following: > While looking into branch prediction in gcc I found this post describing > the "likely" and "unlikely" macros in Linux: > > http://kerneltrap.org/node/4705 > > In short, they are wrappers for the gcc-specific __builtin_expect for > static branch prediction. > > Grepping around I see it is defined and used locally in several places: > > amd64/include/xen/xen-os.h:#define likely(x) __builtin_expect((x),1) > amd64/include/xen/xen-os.h:#define unlikely(x) __builtin_expect((x),0) > dev/nxge/xge-osdep.h:#define xge_os_unlikely(x) (x) > gnu/fs/xfs/FreeBSD/xfs_compat.h:#define likely(x) > __builtin_expect((x), 1) > gnu/fs/xfs/FreeBSD/xfs_compat.h:#define unlikely(x) > __builtin_expect((x), 0) > i386/include/xen/xen-os.h:#define likely(x) __builtin_expect((x),1) > i386/include/xen/xen-os.h:#define unlikely(x) __builtin_expect((x),0) > sun4v/include/cpu.h:#define likely(x) __builtin_expect((x),1) > sun4v/include/cpu.h:#define unlikely(x) __builtin_expect((x),0) > > Wouldn't it be more convenient to have a single global definition of > them, under #ifdef __GNUC__ for example in sys/stddef.h ? __predict_true/__predict_false -- Andriy Gapon From owner-freebsd-arch@FreeBSD.ORG Fri Mar 12 12:59:21 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 040C5106564A; Fri, 12 Mar 2010 12:59:21 +0000 (UTC) (envelope-from stefan@fafoe.narf.at) Received: from viefep22-int.chello.at (viefep22-int.chello.at [62.179.121.42]) by mx1.freebsd.org (Postfix) with ESMTP id 0ACF28FC12; Fri, 12 Mar 2010 12:59:19 +0000 (UTC) Received: from edge04.upcmail.net ([192.168.13.239]) by viefep11-int.chello.at (InterMail vM.8.01.02.00 201-2260-120-20100118) with ESMTP id <20100312124301.JDAE16311.viefep11-int.chello.at@edge04.upcmail.net>; Fri, 12 Mar 2010 13:43:01 +0100 Received: from mole.fafoe.narf.at ([213.47.85.26]) by edge04.upcmail.net with edge id sCiz1d03C0a5KZh04Cj0mu; Fri, 12 Mar 2010 13:43:01 +0100 X-SourceIP: 213.47.85.26 Received: by mole.fafoe.narf.at (Postfix, from userid 1001) id 414966D41B; Fri, 12 Mar 2010 13:42:59 +0100 (CET) Date: Fri, 12 Mar 2010 13:42:59 +0100 From: Stefan Farfeleder To: Ed Schouten Message-ID: <20100312124258.GE1738@mole.fafoe.narf.at> References: <20100312122559.GU8200@hoeg.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100312122559.GU8200@hoeg.nl> User-Agent: Mutt/1.5.20 (2009-06-14) X-Cloudmark-Analysis: v=1.1 cv=njNPHi+DQDbBstGV8v+G+22uStbhm/9+iYoC8d6PAUw= c=1 sm=0 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=7F2wolIoasNwT6X3mrIA:9 a=Z55sgIiyV6pNbxMxrEjHfJwA3u4A:4 a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Cc: Ivan Voras , freebsd-arch@freebsd.org Subject: Re: likely and unlikely X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2010 12:59:21 -0000 On Fri, Mar 12, 2010 at 01:26:08PM +0100, Ed Schouten wrote: > Hi Ivan, > > * Ivan Voras wrote: > > Wouldn't it be more convenient to have a single global definition of > > them, under #ifdef __GNUC__ for example in sys/stddef.h ? > > Wouldn't it be better to have them in sys/cdefs.h? Putting macros 'likely' and 'unlikely' into sys/cdefs.h creates a big namespace violation problem; C code using those identifiers will break. Stefan From owner-freebsd-arch@FreeBSD.ORG Fri Mar 12 14:26:16 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99FF0106564A for ; Fri, 12 Mar 2010 14:26:16 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by mx1.freebsd.org (Postfix) with ESMTP id 2E9A58FC08 for ; Fri, 12 Mar 2010 14:26:15 +0000 (UTC) Received: from vampire.homelinux.org (dslb-088-064-178-136.pools.arcor-ip.net [88.64.178.136]) by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis) id 0MH3Li-1Ntzde1SJm-00DmcU; Fri, 12 Mar 2010 15:13:40 +0100 Received: (qmail 15568 invoked from network); 12 Mar 2010 14:13:39 -0000 Received: from f8x64.laiers.local (192.168.4.188) by mx.laiers.local with SMTP; 12 Mar 2010 14:13:39 -0000 From: Max Laier To: freebsd-arch@freebsd.org Date: Fri, 12 Mar 2010 15:13:38 +0100 User-Agent: KMail/1.12.4 (FreeBSD/8.0-RELEASE-p2; KDE/4.3.5; amd64; ; ) References: <20100312122559.GU8200@hoeg.nl> <20100312124258.GE1738@mole.fafoe.narf.at> In-Reply-To: <20100312124258.GE1738@mole.fafoe.narf.at> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201003121513.38721.max@love2party.net> X-Provags-ID: V01U2FsdGVkX19yUenW3mR58DqUWhAbwJcZmVY2JHypcqI5XEB Whq5DcMTwClki1QCFtuGqmFyMx6MaFWD4skNVenmqTWLPgxT7b qjKHn6R5ibH2cFFayQ70w== Subject: Re: likely and unlikely X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2010 14:26:16 -0000 On Friday 12 March 2010 13:42:59 Stefan Farfeleder wrote: > On Fri, Mar 12, 2010 at 01:26:08PM +0100, Ed Schouten wrote: > > Hi Ivan, > > > > * Ivan Voras wrote: > > > Wouldn't it be more convenient to have a single global definition of > > > them, under #ifdef __GNUC__ for example in sys/stddef.h ? > > > > Wouldn't it be better to have them in sys/cdefs.h? > > Putting macros 'likely' and 'unlikely' into sys/cdefs.h creates a big > namespace violation problem; C code using those identifiers will break. In addition, I don't think it's a good thing to make these too easy to use ... I found that they are a pessimisation more often than not. In addition, it seems that at least our base gcc version does forget to apply any other optimizations if it encounters one of these. My point is: Handle with care!!! Trust your compiler/CPU predictors/... - most of the time, they are smarter than you are ;) Regards, Max From owner-freebsd-arch@FreeBSD.ORG Sat Mar 13 09:24:45 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0179F106564A for ; Sat, 13 Mar 2010 09:24:45 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 8E8C18FC0C for ; Sat, 13 Mar 2010 09:24:44 +0000 (UTC) Received: from c220-239-227-59.carlnfd1.nsw.optusnet.com.au (c220-239-227-59.carlnfd1.nsw.optusnet.com.au [220.239.227.59]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o2D9OcgS005617 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 13 Mar 2010 20:24:42 +1100 Date: Sat, 13 Mar 2010 20:24:39 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Max Laier In-Reply-To: <201003121513.38721.max@love2party.net> Message-ID: <20100313200155.O22734@delplex.bde.org> References: <20100312122559.GU8200@hoeg.nl> <20100312124258.GE1738@mole.fafoe.narf.at> <201003121513.38721.max@love2party.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-arch@freebsd.org Subject: Re: likely and unlikely X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2010 09:24:45 -0000 On Fri, 12 Mar 2010, Max Laier wrote: > On Friday 12 March 2010 13:42:59 Stefan Farfeleder wrote: >> On Fri, Mar 12, 2010 at 01:26:08PM +0100, Ed Schouten wrote: >>> Hi Ivan, >>> >>> * Ivan Voras wrote: >>>> Wouldn't it be more convenient to have a single global definition of >>>> them, under #ifdef __GNUC__ for example in sys/stddef.h ? >>> >>> Wouldn't it be better to have them in sys/cdefs.h? >> >> Putting macros 'likely' and 'unlikely' into sys/cdefs.h creates a big >> namespace violation problem; C code using those identifiers will break. > > In addition, I don't think it's a good thing to make these too easy to use ... IIndeed. The existing spelling of them in sys/cdefs.h (__predict_true and __predict_false) is bad enough. > I found that they are a pessimisation more often than not. In addition, it > seems that at least our base gcc version does forget to apply any other > optimizations if it encounters one of these. Interesting. I thought they were about as useful as "register". But the compiler ignores "register", so "register" is not even a pessimization. > My point is: Handle with care!!! Trust your compiler/CPU predictors/... - > most of the time, they are smarter than you are ;) These macros may have useful 15-25 years ago for i386, i486 and Pentium1, since CPU branch predictors were either nonexistent or not so good. After that, CPU branch predictors became quite good. The macros should have been mostly unused 15-25 years ago too, since they optimize for unreadability and unwritability. Fortunately they are rarely used in FreeBSD. They were imported from NetBSD in 2003 where they are used more (306 instances in 2005 NetBSD /sys vs 28 instances in 2004 FreeBSD /sys; there are 2208 instances of likely() in 2004 linux-2.6.10). Bruce From owner-freebsd-arch@FreeBSD.ORG Sat Mar 13 13:47:37 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F767106566C for ; Sat, 13 Mar 2010 13:47:37 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 18FBA8FC08 for ; Sat, 13 Mar 2010 13:47:37 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id A5AC746B8C; Sat, 13 Mar 2010 08:47:36 -0500 (EST) Date: Sat, 13 Mar 2010 13:47:36 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Bruce Evans In-Reply-To: <20100313200155.O22734@delplex.bde.org> Message-ID: References: <20100312122559.GU8200@hoeg.nl> <20100312124258.GE1738@mole.fafoe.narf.at> <201003121513.38721.max@love2party.net> <20100313200155.O22734@delplex.bde.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Max Laier , freebsd-arch@freebsd.org Subject: Re: likely and unlikely X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2010 13:47:37 -0000 On Sat, 13 Mar 2010, Bruce Evans wrote: >> My point is: Handle with care!!! Trust your compiler/CPU predictors/... - >> most of the time, they are smarter than you are ;) > > These macros may have useful 15-25 years ago for i386, i486 and Pentium1, > since CPU branch predictors were either nonexistent or not so good. After > that, CPU branch predictors became quite good. The macros should have been > mostly unused 15-25 years ago too, since they optimize for unreadability and > unwritability. Fortunately they are rarely used in FreeBSD. They were > imported from NetBSD in 2003 where they are used more (306 instances in 2005 > NetBSD /sys vs 28 instances in 2004 FreeBSD /sys; there are 2208 instances > of likely() in 2004 linux-2.6.10). I think it would be reasonable to expect that people deploy branch prediction macros (as with prefetch, etc) only where there's specific measurements that indicate they are important to have there -- at the very least, pmc data, but ideally also benchmarking data. Robert N M Watson Computer Laboratory University of Cambridge From owner-freebsd-arch@FreeBSD.ORG Sat Mar 13 14:41:07 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5BFF106566B; Sat, 13 Mar 2010 14:41:07 +0000 (UTC) (envelope-from matthew.fleming@isilon.com) Received: from seaxch09.isilon.com (seaxch09.isilon.com [74.85.160.25]) by mx1.freebsd.org (Postfix) with ESMTP id 93E4B8FC14; Sat, 13 Mar 2010 14:41:07 +0000 (UTC) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Date: Sat, 13 Mar 2010 06:41:07 -0800 Message-ID: <06D5F9F6F655AD4C92E28B662F7F853E021D4D26@seaxch09.desktop.isilon.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: likely and unlikely Thread-Index: AcrCs8mioc28j9AzRwiAolnlcr7qfgABnN1b References: <20100312122559.GU8200@hoeg.nl> <20100312124258.GE1738@mole.fafoe.narf.at> <201003121513.38721.max@love2party.net> <20100313200155.O22734@delplex.bde.org> From: "Matthew Fleming" To: "Robert Watson" , "Bruce Evans" Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Max Laier , freebsd-arch@freebsd.org Subject: RE: likely and unlikely X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2010 14:41:07 -0000 Apologies for the top-post but this web mail client doesnt know anything = else. I would think that, from a theoretical POV, you also would want to force = branch prediction around optional code thats rarely enabled. We use it = at Isilon for our internal profiling tool, so the execution cost of = compiling in the profiler is minimized unless its turned on, and also = for our logging macros, so that the cost of always compiling in checks = against log predicates is minimized. The only example I remember from Linux was actually a clever one: the = idle thread assumes there is a real thread to schedule, using = likely/unlikely, even though practically speaking they got the = prediction "wrong". The reason is that, if the idle thread is going to = continue to run, the cost of an incorrect branch prediction is not = relevant, but if there is real work to do why waste time on a pipeline = flush due to incorrect prediction. Thanks, matthew -Original Message- From: owner-freebsd-arch@freebsd.org on behalf of Robert Watson Sent: Sat 13-Mar-10 5:47 AM To: Bruce Evans Cc: Max Laier freebsd-arch@freebsd.org Subject: Re: likely and unlikely =20 On Sat, 13 Mar 2010, Bruce Evans wrote: >> My point is: Handle with care!!! Trust your compiler/CPU = predictors/... -=20 >> most of the time, they are smarter than you are ) > > These macros may have useful 15-25 years ago for i386, i486 and = Pentium1,=20 > since CPU branch predictors were either nonexistent or not so good. = After=20 > that, CPU branch predictors became quite good. The macros should have = been=20 > mostly unused 15-25 years ago too, since they optimize for = unreadability and=20 > unwritability. Fortunately they are rarely used in FreeBSD. They = were=20 > imported from NetBSD in 2003 where they are used more (306 instances = in 2005=20 > NetBSD /sys vs 28 instances in 2004 FreeBSD /sys there are 2208 = instances=20 > of likely() in 2004 linux-2.6.10). I think it would be reasonable to expect that people deploy branch = prediction=20 macros (as with prefetch, etc) only where theres specific measurements = that=20 indicate they are important to have there at the very least, pmc data, = but=20 ideally also benchmarking data. Robert N M Watson Computer Laboratory University of Cambridge _______________________________________________ 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"