mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chuck Ebbert <76306.1226@compuserve.com>
To: Denis Vlasenko <vda@ilport.com.ua>
Cc: cutaway@bellsouth.net, Coywolf Qi Hunt <coywolf@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] exit_thread() speedups in x86 process.c
Date: Wed, 22 Jun 2005 01:48:08 -0400	[thread overview]
Message-ID: <200506220150_MC3-1-A23C-875A@compuserve.com> (raw)

On Tue, 14 Jun 2005 10:43:03 +0300, Denis Vlasenko wrote:

> On Tuesday 14 June 2005 07:26, cutaway@bellsouth.net wrote:
> > The problem with that approach is GCC would still just relocate the push/pop
> > block to the bottom of the function.  This means you won't be likely to pick
> > up anything useful in L1 or L2 as the function exits normally - in fact
> > you'd typically be guaranteed to be picking up a partial line of gorp that
> > is completely worthless later on.
> > 
> > This is one of my issues with the notion of unlikely() being smoothed on
> > everywhere like Bondo<g> - it also makes it "unlikely" that you'll get any
> > serendipitous L1/L2 advantages that could be had by locating related
> > functions next to each other.
> > 
> > When you take the unlikely stuff completely out of line in a seperate
> > functions located elsewhere, the mainline code can make better use of the
> > caches.  The Intel parts thrive on L1 hits and die if they're not getting
> > them.
> 
> That's exactly what compiler can do by itself. The fact that currently
> it isn't smart enough to od it means that it has to be improved.
> You propose that people have to do compiler's job.

  Not just the compiler -- the linker would need to be a lot smarter too:


/* foo.c */

extern int bar1(void), bar2(void), bar3(void);

main() {
        if (likely(bar1()))
                bar2();
        else
                bar3();
}


/* bar.c */

int bar1(void) { return 1; }
int bar2(void) { whatever; }
int bar3(void) { whatever; }


  When you compile bar.c the compiler has _no_ idea which functions are likely
to be called.

  And doing this manually is trivial:

        1. Add two sections to vmlinux.lds.S: .fast.text and .slow.text
        2. Define __fast __attribute__(__section__(".fast.text"))
        3. Define __slow similarly
        4. Start tagging functions with __fast and __slow as needed

  Very little work for much potential gain, AFAICS.


--
Chuck

             reply	other threads:[~2005-06-22  9:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-22  5:48 Chuck Ebbert [this message]
2005-06-22  8:41 ` cutaway
  -- strict thread matches above, loose matches on Subject: below --
2005-07-05 18:30 William Cohen
     [not found] <200507012258_MC3-1-A340-3A81@compuserve.com.suse.lists.linux.kernel>
     [not found] ` <200507021456.40667.vda@ilport.com.ua.suse.lists.linux.kernel>
2005-07-03 16:05   ` Andi Kleen
2005-07-02  2:57 Chuck Ebbert
2005-07-02 11:56 ` Denis Vlasenko
2005-07-03 19:59   ` cutaway
2005-06-14  1:16 cutaway
2005-06-14  3:08 ` Coywolf Qi Hunt
2005-06-14  4:26   ` cutaway
2005-06-14  7:43     ` Denis Vlasenko

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=200506220150_MC3-1-A23C-875A@compuserve.com \
    --to=76306.1226@compuserve.com \
    --cc=coywolf@gmail.com \
    --cc=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®