From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Thomas_Hellstr=F6m?= Subject: Re: drm/vmwgfx: Fix compat shader namespace Date: Fri, 11 Jul 2014 00:14:25 +0200 Message-ID: <53BF1041.5000103@vmware.com> References: <20140709124807.GA7707@mwanda> <53BDB4C1.7090309@vmware.com> <20140710093318.GJ23001@mwanda> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"; Format="flowed" Content-Transfer-Encoding: quoted-printable Return-path: Received: from smtp-outbound-2.vmware.com (smtp-outbound-2.vmware.com [208.91.2.13]) by gabe.freedesktop.org (Postfix) with ESMTP id 39B646E01B for ; Thu, 10 Jul 2014 15:14:32 -0700 (PDT) In-Reply-To: <20140710093318.GJ23001@mwanda> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Dan Carpenter Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On 2014-07-10 11:33, Dan Carpenter wrote: > On Wed, Jul 09, 2014 at 11:31:45PM +0200, Thomas Hellstr=F6m wrote: >>> Speaking of verbose, all the likely/unlikely annotations should be >>> removed. >> Is this your personal opinion or has there been some kind of kernel >> developer agreement not to add this annotation and remove it from >> the kernel tree? If not, I prefer to keep it. > It obviously makes the code less readable. It makes a small speedup if > the code is called 10000 times with the and the expected value is true > every time. If more than 1 out of 10000 values is unexpected then it is > a slow down. You may be right, but most people citicising branch prediction hints = tend to stare blindly at probabilities and forget about fastpath = optimization where you don't care at all about the execution speed of = the slowpath and therefore hint the compiler to take the fastpath branch = regardless of probabilities. My guess is it would be pretty hard to do = that incorrectly. I agree, however that readability may be more important than the = fastpath execution speed gained from this. But in my case not so much = that I spontaneously feel like removing all branch prediction hints from = the vmwgfx driver. > > There are two rules of thumb for likely/unlikely: > > 1) Don't use it in the drivers/ directory. > 2) Or don't use it without benchmarking it. Could you point me to a document or some sort of reference? Thanks, Thomas