From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753837AbcCZTGV (ORCPT ); Sat, 26 Mar 2016 15:06:21 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:32979 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752629AbcCZTGQ (ORCPT ); Sat, 26 Mar 2016 15:06:16 -0400 From: Rasmus Villemoes To: Andrew Morton Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andi Kleen , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 2/2] include/linux: apply __malloc attribute Organization: D03 References: <1458776553-9033-1-git-send-email-linux@rasmusvillemoes.dk> <1458776553-9033-2-git-send-email-linux@rasmusvillemoes.dk> <20160324153639.bb996d7bf5a585dfb46740b7@linux-foundation.org> X-Hashcash: 1:20:160326:rientjes@google.com::/H6hCAkhZV8GF8xe:0000000000000000000000000000000000000000000Ykd X-Hashcash: 1:20:160326:ak@linux.intel.com::qKQ4evBjd8WxtvEM:00000000000000000000000000000000000000000000ZaF X-Hashcash: 1:20:160326:penberg@kernel.org::L58TfdRJ/0gUvFfo:00000000000000000000000000000000000000000000zFB X-Hashcash: 1:20:160326:linux-kernel@vger.kernel.org::CluS0fLmaTMRpuIC:0000000000000000000000000000000002FMu X-Hashcash: 1:20:160326:linux-mm@kvack.org::3xjZcQUWQuqo7FIj:00000000000000000000000000000000000000000002ncQ X-Hashcash: 1:20:160326:cl@linux.com::LG2xRk63SUO5a1k9:000003oIX X-Hashcash: 1:20:160326:akpm@linux-foundation.org::USBy9CpRHYMwWj4E:0000000000000000000000000000000000003e7D X-Hashcash: 1:20:160326:iamjoonsoo.kim@lge.com::taAmfos06ttBhlmL:0000000000000000000000000000000000000003TaH Date: Sat, 26 Mar 2016 20:06:13 +0100 In-Reply-To: <20160324153639.bb996d7bf5a585dfb46740b7@linux-foundation.org> (Andrew Morton's message of "Thu, 24 Mar 2016 15:36:39 -0700") Message-ID: <87mvplukii.fsf@rasmusvillemoes.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 24 2016, Andrew Morton wrote: > On Thu, 24 Mar 2016 00:42:32 +0100 Rasmus Villemoes wrote: > >> Attach the malloc attribute to a few allocation functions. This helps >> gcc generate better code by telling it that the return value doesn't >> alias any existing pointers (which is even more valuable given the >> pessimizations implied by -fno-strict-aliasing). >> > Shaves 6 bytes off my 1MB i386 defconfig vmlinux. Winner! Well, the full bloat-o-meter summary is add/remove: 0/0 grow/shrink: 72/155 up/down: 1165/-1674 (-509) which sure still isn't much, but this isn't (just) about saving a few bytes, but more about allowing gcc to generate better code; sometimes by not having to reload, but also by enabling it to reorder instructions (e.g. hoisting a load above a store) - the simple example was chosen because it was very easy to see the relationship between the source and the generated code. Anyway, thanks for picking them up. Rasmus