public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Jan Beulich <JBeulich@novell.com>
Cc: mingo@elte.hu, tglx@linutronix.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: make use of inc/dec conditional
Date: Wed, 19 Aug 2009 09:48:30 -0700	[thread overview]
Message-ID: <4A8C2CDE.1010405@zytor.com> (raw)
In-Reply-To: <4A8BCA850200007800010836@vpn.id2.novell.com>

On 08/19/2009 12:48 AM, Jan Beulich wrote:
> According to gcc's instruction selection, inc/dec can be used without
> penalty on most CPU models, but should be avoided on others. Hence we
> should have a config option controlling the use of inc/dec, and
> respective abstraction macros to avoid making the resulting code too
> ugly. There are a few instances of inc/dec that must be retained in
> assembly code, due to that code's dependency on the instruction not
> changing the carry flag.

One thing: I doubt it matters one measurable iota when it comes to
locked operations.

Furthermore:

-		     "decl %2	;\n"
+		     _ASM_DECL "%2	;\n"
 		     "jne 1b		;\n"
 		     "adcl $0, %0	;\n"

It looks to me that the carry flag is live across the dec there.  The
other csum code look scary to me too.

The rest of them look technically okay, but you're bloating them by two
bytes (one byte in 64-bit mode) for every instance.  You may want to
consider if any particular instance is more icache-critical than
stall-critical.  This is probably more of a concern for inlines than for
regular single-instance code like the string operations.

	-hpa


-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


  parent reply	other threads:[~2009-08-19 16:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-19  7:48 [PATCH] x86: make use of inc/dec conditional Jan Beulich
2009-08-19  8:01 ` Peter Zijlstra
2009-08-19  9:00   ` Jan Beulich
2009-08-19  9:06     ` Thomas Gleixner
2009-08-19  9:23       ` Jan Beulich
2009-08-19  9:56         ` Thomas Gleixner
2009-08-19 16:48 ` H. Peter Anvin [this message]
2009-08-20  7:12   ` Jan Beulich
2009-08-27  7:34     ` Tejun Heo
2009-08-28  6:31       ` Jan Beulich

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=4A8C2CDE.1010405@zytor.com \
    --to=hpa@zytor.com \
    --cc=JBeulich@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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