public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kurt Roeckx <Q@ping.be>
To: Rogier Wolff <R.E.Wolff@BitWizard.nl>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, linux-kernel@vger.kernel.org
Subject: Re: Athlon possible fixes
Date: Sat, 5 May 2001 18:42:22 +0200	[thread overview]
Message-ID: <20010505184222.A26477@ping.be> (raw)
In-Reply-To: <E14vwaq-0000Jk-00@the-village.bc.nu> <200105051626.SAA16651@cave.bitwizard.nl>
In-Reply-To: <200105051626.SAA16651@cave.bitwizard.nl>

On Sat, May 05, 2001 at 06:26:30PM +0200, Rogier Wolff wrote:
> 
> As all this is trying to avoid bus turnarounds (i.e. switching from
> reading to writing), wouldn't it be fastest to just trust that the CPU
> has at least 4k worth of cache? (and hope for the best that we don't
> get interrupted in the meanwhile).
> 
> void copy_page (char *dest, char *source)
> {
> 	long *dst = (long *)dest, 
> 		*src=(long *)source, 
> 		*end= (long *)(source+PAGE_SIZE);
> #if 1
> 	register int  i;
> 	long t=0;
> 	static long tt;
> 
>   	for (i=0;i<PAGE_SIZE/sizeof (long);i += cache_line_size()/sizeof(long))
> 	/* Actually the innards of this loop should be:
> 		(void) from[i];
> 	   however, the compiler will probably optimize that away. */ 
>      		t += src[i];
> 
> 	tt = t;
> #endif
> 	while (src < end)
> 		*dst++ = *src++;
> 
> }
> 
> So, this is 15 lines of C, and it'd be interesting to benchmark this
> against the assembly.
> 
> I'm assuming that the "loop variable handling" is not going to
> influence the overall performance: that would run at 500 - 1000MHz,
> and around 1 clock cycle (1-2ns) per loop. Set this against the stalls
> against the memory unit whose output buffer is full, and memory writes
> that take on the order of 30 ns per 64bits.

Can't you use volatile to prevent the compiler from optimizing
it?


Kurt


  reply	other threads:[~2001-05-05 16:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-05  7:35 Athlon possible fixes Alan Cox
2001-05-05 16:26 ` Rogier Wolff
2001-05-05 16:42   ` Kurt Roeckx [this message]
2001-05-05 22:44   ` Seth Goldberg
2001-05-06 16:44     ` Jussi Laako
2001-05-06 17:41       ` Zilvinas Valinskas
2001-05-06 18:16       ` Christian Bornträger
2001-05-06 19:23         ` Marek Pętlicki
2001-05-07 18:54         ` Jussi Laako
2001-05-11 20:09         ` Jussi Laako
2001-05-11 20:22           ` Alan Cox
2001-05-12  9:51             ` Jussi Laako
2001-05-06  2:23 ` Chris Wedgwood
2001-05-06 12:51   ` Alan Cox
2001-05-06 13:00     ` Chris Wedgwood
2001-05-11  4:02     ` Ralf Baechle
  -- strict thread matches above, loose matches on Subject: below --
2001-05-12 18:31 Ishikawa
2001-05-12 23:02 ` Alan Cox

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=20010505184222.A26477@ping.be \
    --to=q@ping.be \
    --cc=R.E.Wolff@BitWizard.nl \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /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