From: R.E.Wolff@BitWizard.nl (Rogier Wolff)
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Athlon possible fixes
Date: Sat, 5 May 2001 18:26:30 +0200 (MEST) [thread overview]
Message-ID: <200105051626.SAA16651@cave.bitwizard.nl> (raw)
In-Reply-To: <E14vwaq-0000Jk-00@the-village.bc.nu> from Alan Cox at "May 5, 2001 08:35:06 am"
> + __asm__ __volatile__ (
> + " movq (%0), %%mm0\n"
> + " movq 8(%0), %%mm1\n"
> + " movq 16(%0), %%mm2\n"
> + " movq 24(%0), %%mm3\n"
> + " movq %%mm0, (%1)\n"
> + " movq %%mm1, 8(%1)\n"
> + " movq %%mm2, 16(%1)\n"
> + " movq %%mm3, 24(%1)\n"
> + " movq 32(%0), %%mm0\n"
> + " movq 40(%0), %%mm1\n"
> + " movq 48(%0), %%mm2\n"
> + " movq 56(%0), %%mm3\n"
> + " movq %%mm0, 32(%1)\n"
> + " movq %%mm1, 40(%1)\n"
> + " movq %%mm2, 48(%1)\n"
> + " movq %%mm3, 56(%1)\n"
> : : "r" (from), "r" (to) : "memory");
> from+=64;
> to+=64;
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.
At least, that's what I expect, however, I haven't been optimizing
cycles for quite a while....
Roger.
--
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
* There are old pilots, and there are bold pilots.
* There are also old, bald pilots.
next prev parent reply other threads:[~2001-05-05 16:27 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 [this message]
2001-05-05 16:42 ` Kurt Roeckx
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=200105051626.SAA16651@cave.bitwizard.nl \
--to=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