mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <cutaway@bellsouth.net>
To: "Denis Vlasenko" <vda@ilport.com.ua>, <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] Observations on x86 process.c
Date: Mon, 13 Jun 2005 12:32:08 -0400	[thread overview]
Message-ID: <000a01c57035$79738a80$2800000a@pc365dualp2> (raw)
In-Reply-To: <200506131618.09718.vda@ilport.com.ua>

This is a good idea BTW.

It could be expanded upon further by adding something else to designate
error case and infrequent oddball situation code blocks.  Even "fast"
functions often include large sections of stuff that doesn't need speed
optimizations.  That stuff just winds up puffing up the L1/L2 when bits of
it get touched.  A compiler smart enough to emit function code to two
different .text regions could take advantage of this.

ex.

int __fast fast1(whatever...)
{
    if (rare_case) {
    ...large blob of non-speed critical code...
    }
    ...fast code...
}

int __fast fast2(whatever...)

The way it happens today is GCC (usually) relocates the blob of speed
insensitive code towards the bottom of the function, which means you're less
likely to pick up a bit of fast2()'s prolog as you're exiting fast1, and
more likely to pollute the caches with worthless stuff.

If blocks can be designated as infrequent/error paths and relocatable to a
different .text section you stand a much better chance of picking up
something useful as functions exit.  ex:

int __fast fast1(whatever...)
{
    if (rare_case) __attribute__((slowcode)) {
    ...large blob of non-speed critical code...
    }
    ...fast code...
}

Where __attribute__((slowcode)) is defined in some macro.


----- Original Message ----- 
From: "Denis Vlasenko" <vda@ilport.com.ua>
>
> What about having a __speed macro:
>
> int very_frequently_user_func() __speed {
> ...
> }


  parent reply	other threads:[~2005-06-13 15:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-13 13:02 cutaway
2005-06-13 12:37 ` Jan Engelhardt
2005-06-13 13:43   ` cutaway
2005-06-13 13:18 ` Denis Vlasenko
2005-06-13 15:01   ` cutaway
2005-06-13 14:26     ` Denis Vlasenko
2005-06-13 16:01       ` cutaway
2005-06-13 16:32   ` cutaway [this message]
2005-06-13 16:02     ` Ian Campbell
2005-06-13 19:37       ` cutaway

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='000a01c57035$79738a80$2800000a@pc365dualp2' \
    --to=cutaway@bellsouth.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vda@ilport.com.ua \
    /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

all inboxes | Powered by JetHome®