From: Cort Dougan <cort@fsmlabs.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: 7.52 second kernel compile
Date: Mon, 18 Mar 2002 15:36:37 -0700 [thread overview]
Message-ID: <20020318153637.J4783@host110.fsmlabs.com> (raw)
In-Reply-To: <Pine.LNX.4.33.0203181146070.4783-100000@home.transmeta.com> <Pine.LNX.4.33.0203181213130.12950-100000@home.transmeta.com>
Here's the modified for PPC version and the results.
The cycle timer in this case is about 16.6MHz.
# ./foo
92.01: 1
7.98: 2
# ./foo
3.71: 0
92.30: 1
3.99: 2
# ./foo
92.01: 1
7.97: 2
# ./foo
92.01: 1
7.97: 2
# ./foo
3.71: 0
92.30: 1
3.99: 2
# ./foo
3.71: 0
92.30: 1
3.99: 2
#include <stdlib.h>
#if defined(__powerpc__)
#define rdtsc(low) \
__asm__ __volatile__ ("mftb %0": "=r" (low))
#else
#define rdtsc(low) \
__asm__ __volatile__("rdtsc" : "=a" (low) : : "edx")
#endif
#define MAXTIMES 1000
#define BUFSIZE (128*1024*1024)
#define access(x) (*(volatile unsigned int *)&(x))
int main()
{
unsigned int i, j;
static int times[MAXTIMES];
char *buffer = malloc(BUFSIZE);
for (i = 0; i < BUFSIZE; i += 4096)
access(buffer[i]);
for (i = 0; i < MAXTIMES; i++)
times[i] = 0;
for (j = 0; j < 100; j++) {
for (i = 0; i < BUFSIZE ; i+= 4096) {
unsigned long start, end;
rdtsc(start);
access(buffer[i]);
rdtsc(end);
end -= start;
if (end >= MAXTIMES)
end = MAXTIMES-1;
times[end]++;
}
}
for (i = 0; i < MAXTIMES; i++) {
int count = times[i];
double percent = (double)count / (BUFSIZE/4096);
if (percent < 1)
continue;
printf("%7.2f: %d\n", percent, i);
}
return v0;
}
} Btw, here's a program that does a simple histogram of TLB miss cost, and
} shows the interesting pattern on intel I was talking about: every 8th miss
} is most costly, apparently because Intel pre-fetches 8 TLB entries at a
} time.
}
} So on a PII core, you'll see something like
}
} 87.50: 36
} 12.39: 40
}
} ie 87.5% (exactly 7/8) of the TLB misses take 36 cycles, while 12.4% (ie
} 1/8) takes 40 cycles (and I assuem that the extra 4 cycles is due to
} actually loading the thing from the data cache).
}
} Yeah, my program might be buggy, so take the numbers with a pinch of salt.
} But it's interesting to see how on an athlon the numbers are
}
} 3.17: 59
} 34.94: 62
} 4.71: 85
} 54.83: 88
}
} ie roughly 60% take 85-90 cycles, and 40% take ~60 cycles. I don't know
} where that pattern would come from..
}
} What are the ppc numbers like (after modifying the rdtsc implementation,
} of course)? I suspect you'll get a less clear distribution depending on
} whether the hash lookup ends up hitting in the primary or secondary hash,
} and where in the list it hits, but..
}
} Linus
next prev parent reply other threads:[~2002-03-18 22:39 UTC|newest]
Thread overview: 96+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-13 8:52 10.31 second kernel compile Anton Blanchard
2002-03-13 14:44 ` Martin J. Bligh
2002-03-13 21:44 ` [Lse-tech] " Dave Hansen
2002-03-14 1:07 ` Keith Owens
2002-03-14 11:27 ` Anton Blanchard
2002-03-14 13:16 ` [Lse-tech] " Dipankar Sarma
2002-03-17 13:12 ` some RCU dcache and ratcache results Anton Blanchard
2002-03-14 13:21 ` [Lse-tech] Re: 10.31 second kernel compile Momchil Velikov
2002-03-14 18:33 ` Daniel Phillips
2002-03-15 12:16 ` Chris Wedgwood
2002-03-16 5:12 ` Anton Blanchard
2002-03-15 18:20 ` Linus Torvalds
2002-03-16 11:55 ` Paul Mackerras
2002-03-16 17:25 ` Rik van Riel
2002-03-16 17:57 ` yodaiken
2002-03-16 18:06 ` Linus Torvalds
2002-03-16 18:35 ` yodaiken
2002-03-16 18:45 ` Linus Torvalds
2002-03-16 18:57 ` yodaiken
2002-03-16 19:16 ` Linus Torvalds
2002-03-16 19:43 ` David Mosberger
2002-03-16 19:58 ` Linus Torvalds
2002-03-16 20:08 ` yodaiken
2002-03-16 20:23 ` Linus Torvalds
2002-03-16 20:36 ` David Mosberger
2002-03-16 20:46 ` Linus Torvalds
2002-03-17 1:09 ` Paul Mackerras
2002-03-17 2:08 ` Linus Torvalds
2002-03-16 19:53 ` yodaiken
2002-03-16 20:02 ` Linus Torvalds
2002-03-16 20:25 ` yodaiken
2002-03-27 1:07 ` Richard Henderson
2002-03-16 20:53 ` Alan Cox
2002-03-18 3:07 ` David S. Miller
2002-03-16 15:24 ` Daniel Phillips
2002-03-16 19:01 ` Linus Torvalds
2002-03-16 22:25 ` Daniel Phillips
2002-03-19 16:35 ` Bill Davidsen
2002-03-14 19:05 ` Linus Torvalds
2002-03-19 16:40 ` Bill Davidsen
2002-03-14 18:21 ` Hanna Linder
2002-03-16 5:27 ` Anton Blanchard
2002-03-15 7:12 ` Chris Wedgwood
2002-03-16 6:15 ` 7.52 " Anton Blanchard
2002-03-16 6:42 ` [Lse-tech] " Gerrit Huizenga
2002-03-17 12:34 ` Anton Blanchard
2002-03-17 22:09 ` Theodore Tso
2002-03-18 7:04 ` Jeff Garzik
2002-03-19 18:28 ` Theodore Tso
2002-03-16 8:05 ` Linus Torvalds
2002-03-16 11:04 ` Paul Mackerras
2002-03-16 18:32 ` Linus Torvalds
2002-03-17 2:00 ` Paul Mackerras
2002-03-17 2:40 ` Linus Torvalds
2002-03-17 2:50 ` M. Edward Borasky
2002-03-18 15:08 ` 0.73 " snpe
2002-03-18 19:42 ` 7.52 " Cort Dougan
2002-03-18 20:04 ` Linus Torvalds
2002-03-18 20:23 ` Linus Torvalds
2002-03-18 21:50 ` Rene Herman
2002-03-18 22:36 ` Cort Dougan [this message]
2002-03-18 22:47 ` Linus Torvalds
2002-03-18 22:56 ` Cort Dougan
2002-03-18 23:52 ` Paul Mackerras
2002-03-19 0:57 ` Dave Jones
2002-03-19 3:35 ` Jeff Garzik
2002-03-19 0:22 ` David S. Miller
2002-03-19 0:27 ` Cort Dougan
2002-03-19 0:27 ` David S. Miller
2002-03-19 0:36 ` Cort Dougan
2002-03-19 0:38 ` David S. Miller
2002-03-19 1:28 ` Davide Libenzi
2002-03-19 2:42 ` Paul Mackerras
2002-03-27 2:53 ` Richard Henderson
2002-04-02 4:32 ` Linus Torvalds
2002-04-02 10:50 ` Pablo Alcaraz
2002-03-18 21:34 ` Cort Dougan
2002-03-18 22:00 ` Linus Torvalds
2002-03-18 19:37 ` Cort Dougan
2002-03-16 11:54 ` yodaiken
2002-03-16 17:37 ` [Lse-tech] " Martin J. Bligh
2002-03-16 18:57 ` Daniel Egger
2002-03-17 8:18 ` Mike Galbraith
2002-03-17 15:29 ` Martin J. Bligh
2002-03-17 1:45 ` Keith Owens
2002-03-17 13:54 ` David Woodhouse
2002-03-19 16:49 ` Bill Davidsen
-- strict thread matches above, loose matches on Subject: below --
2002-03-18 22:12 Dieter Nützel
2002-03-18 22:46 ` Linus Torvalds
2002-03-18 23:53 ` Davide Libenzi
2002-03-19 0:20 ` David S. Miller
2002-03-19 0:47 ` Davide Libenzi
2002-03-19 1:37 ` Andreas Ferber
2002-03-19 1:38 ` David S. Miller
2002-03-19 2:08 ` Linus Torvalds
2002-03-19 5:24 ` Erik Andersen
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=20020318153637.J4783@host110.fsmlabs.com \
--to=cort@fsmlabs.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/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