From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111951 invoked by alias); 26 Jan 2016 21:45:05 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 111933 invoked by uid 89); 26 Jan 2016 21:45:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=our X-HELO: mx1.redhat.com Subject: Re: [PATCH] malloc: remove __builtin_expect To: munroesj@linux.vnet.ibm.com References: <1453767942-19369-1-git-send-email-joern@purestorage.com> <1453767942-19369-21-git-send-email-joern@purestorage.com> <56A726C1.6070206@samsung.com> <1453840993.18407.2.camel@oc7878010663> <56A7E028.6050204@redhat.com> <1453844092.18407.9.camel@oc7878010663> Cc: Yury Gribov , Joern Engel , "GNU C. Library" , Siddhesh Poyarekar , Joern Engel From: Florian Weimer Message-ID: <56A7E8D9.2090908@redhat.com> Date: Tue, 26 Jan 2016 21:45:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <1453844092.18407.9.camel@oc7878010663> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-01/txt/msg00768.txt.bz2 On 01/26/2016 10:34 PM, Steven Munroe wrote: >> Based on what I saw, glibc uses __builtin_expect and the macros derived >> from it in two conflicting ways: to express that one alternative is more >> likely that the other, and to state that some alternative is impossible >> in practice (for a well-behaved program in particular). >> >> GCC's current interpretation leans towards the latter, at least on >> x86_64. I think GCC even puts unlikely code into separate text sections >> in some cases. Most of our __builtin_expect uses seem to be of the >> former nature: things that can and do happen during normal operation, >> like an unusual character in a character set conversion, or a >> locale-related environment variable which is set. >> > I am also concerned the GCC has some serious bugs in its block frequency > handling. For example: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67755 Hmm. So maybe what I saw looking at disassembly was a consequence of this bug, and not intended GCC behavior. Florian