linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <ak@muc.de>
To: "David S. Miller" <davem@redhat.com>
Cc: hch@infradead.org, ak@muc.de, torvalds@transmeta.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Use __attribute__((malloc)) for gcc 3.2
Date: Mon, 30 Sep 2002 02:29:15 +0200	[thread overview]
Message-ID: <20020930002915.GA2805@averell> (raw)
In-Reply-To: <20020929.171110.04716295.davem@redhat.com>

On Mon, Sep 30, 2002 at 02:11:10AM +0200, David S. Miller wrote:
>    From: Christoph Hellwig <hch@infradead.org>
>    Date: Sun, 29 Sep 2002 18:26:43 +0100
>    
>    BTW, do you have any stats on the better optimization?
> 
> Unlikely since we disable strict aliasing on the gcc command
> line which is why I think this suggested __malloc thing is
> utterly pointless.

My understanding of it is: Please correct me if I'm wrong [i haven't 
verified this with tree dumps]

-fno-strict-aliasing tells each pointer that it can alias with everything
else (puts it in alias set 0)

__attribute__((malloc)) overwrites this so that the compiler knows that
this particular pointer that has been returned  (puts it into an own
alias set again and overwrites the -fno-strict-aliasing default) 

Another way to overwrite it would be restrict, but nobody uses that
currently. May make sense to add it to compile compiler version checked
macros too, so that it can be safely used.

Then it would be actually possible to write functions that get optimized
this way. I'm aware that the aliasing stuff mostly helps with array walks
and loops, which are not that common in the kernel, but it could be still
useful.

-Andi

  reply	other threads:[~2002-09-30  0:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-29 15:27 [PATCH] Use __attribute__((malloc)) for gcc 3.2 Andi Kleen
2002-09-29 16:24 ` Adrian Bunk
2002-09-29 17:26 ` Christoph Hellwig
2002-09-30  0:11   ` David S. Miller
2002-09-30  0:29     ` Andi Kleen [this message]
2002-09-29 20:01 ` Jakub Jelinek
2002-09-30  0:04   ` Andi Kleen
2002-10-07 10:05   ` Richard Henderson
2002-10-07 10:29     ` David S. Miller
2002-10-07 10:56       ` Andi Kleen
2002-10-07 11:07         ` Arjan van de Ven
2002-10-07 11:45         ` Richard Henderson
2002-10-07 12:27           ` Andi Kleen
2002-09-29 23:51 ` Anton Blanchard
2002-09-30  0:31   ` Andi Kleen
2002-09-30  1:07     ` Daniel Jacobowitz
2002-10-02 13:46     ` Pavel Machek
     [not found] <20020929152731.GA10631@averell.suse.lists.linux.kernel>
     [not found] ` <20020929182643.C8564@infradead.org.suse.lists.linux.kernel>
2002-09-29 19:09   ` Andi Kleen
2002-09-29 20:20     ` Adrian Bunk
2002-09-30  0:21     ` David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020930002915.GA2805@averell \
    --to=ak@muc.de \
    --cc=davem@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).