Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(7530)

Issue 87290043: code review 87290043: runtime: reduce gc latency

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years ago by aram
Modified:
10 years ago
Reviewers:
rsc, dvyukov
CC:
golang-codereviews
Visibility:
Public.

Description

runtime: reduce gc latency Replace 1µs/100µs sleeps with yields. These sleeps take up to 10ms on some systems, and usually take 1ms on most systems. When we yield we are usually rescheduled much faster than that. Results on 8-way Linux with tickless kernel: Machine is: $ uname -a Linux 6d0b706a-0ddb-6734-844b-882660956eb8 3.8.6-joyent-debian-6-opt #1 SMP Wed Apr 10 22:00:18 UTC 2013 x86_64 GNU/Linux $ $ lscpu Architecture: x86_64 CPU op-mode(s): 64-bit CPU(s): 8 Thread(s) per core: 1 Core(s) per socket: 1 CPU socket(s): 8 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 44 Stepping: 2 CPU MHz: 2400.024 L1d cache: 32K L1i cache: 32K L2 cache: 4096K $ $ zgrep CONFIG_NO_HZ /proc/config.gz CONFIG_NO_HZ=y $ zgrep HIGH_RES_TIMERS /proc/config.gz CONFIG_HIGH_RES_TIMERS=y Before (on revision b2ebbbcfc615): $ ./runtime.test -test.v -test.cpu=1,2,4,8,16 -test.run TestStackGrowth$ runtime === RUN TestStackGrowth --- PASS: TestStackGrowth (2.23 seconds) === RUN TestStackGrowth-2 --- PASS: TestStackGrowth-2 (2.66 seconds) === RUN TestStackGrowth-4 --- PASS: TestStackGrowth-4 (3.33 seconds) === RUN TestStackGrowth-8 --- PASS: TestStackGrowth-8 (4.02 seconds) === RUN TestStackGrowth-16 --- PASS: TestStackGrowth-16 (3.82 seconds) PASS With this CL: $ ./runtime.test -test.v -test.cpu=1,2,4,8,16 -test.run TestStackGrowth$ runtime === RUN TestStackGrowth --- PASS: TestStackGrowth (2.27 seconds) === RUN TestStackGrowth-2 --- PASS: TestStackGrowth-2 (1.94 seconds) === RUN TestStackGrowth-4 --- PASS: TestStackGrowth-4 (2.94 seconds) === RUN TestStackGrowth-8 --- PASS: TestStackGrowth-8 (3.73 seconds) === RUN TestStackGrowth-16 --- PASS: TestStackGrowth-16 (3.47 seconds) PASS Results on 2-way Solaris with 100Hz clock tick: Machine: ; psrinfo -vp The physical processor has 2 virtual processors (0-1) x86 (GenuineIntel 6F2 family 6 model 15 step 2 clock 1829 MHz) Intel(r) Core(tm)2 CPU T5600 @ 1.83GHz Before: ; runtime.test -test.v -test.cpu=1,2,4,8 -test.run TestStackGrowth$ runtime === RUN TestStackGrowth --- PASS: TestStackGrowth (2.13 seconds) === RUN TestStackGrowth-2 --- PASS: TestStackGrowth-2 (32.48 seconds) === RUN TestStackGrowth-4 --- PASS: TestStackGrowth-4 (32.36 seconds) === RUN TestStackGrowth-8 --- PASS: TestStackGrowth-8 (30.10 seconds) PASS After: ; runtime.test -test.v -test.cpu=1,2,4,8 -test.run TestStackGrowth$ runtime === RUN TestStackGrowth --- PASS: TestStackGrowth (2.08 seconds) === RUN TestStackGrowth-2 --- PASS: TestStackGrowth-2 (2.02 seconds) === RUN TestStackGrowth-4 --- PASS: TestStackGrowth-4 (1.97 seconds) === RUN TestStackGrowth-8 --- PASS: TestStackGrowth-8 (2.00 seconds) PASS Results on 24-way Solaris with 1kHz clock tick: Machine: $ psrinfo -pv The physical processor has 6 cores and 12 virtual processors (1 3 5 7 9 11 13 15 17 19 21 23) The core has 2 virtual processors (1 13) The core has 2 virtual processors (3 15) The core has 2 virtual processors (5 17) The core has 2 virtual processors (7 19) The core has 2 virtual processors (9 21) The core has 2 virtual processors (11 23) x86 (GenuineIntel 206C2 family 6 model 44 step 2 clock 2400 MHz) Intel(r) Xeon(r) CPU E5645 @ 2.40GHz The physical processor has 6 cores and 12 virtual processors (0 2 4 6 8 10 12 14 16 18 20 22) The core has 2 virtual processors (0 12) The core has 2 virtual processors (2 14) The core has 2 virtual processors (4 16) The core has 2 virtual processors (6 18) The core has 2 virtual processors (8 20) The core has 2 virtual processors (10 22) x86 (GenuineIntel 206C2 family 6 model 44 step 2 clock 2400 MHz) Intel(r) Xeon(r) CPU E5645 @ 2.40GHz Before: $ ./runtime.test -test.v -test.cpu=1,2,4,8,12,16,24,32,48 -test.run TestStackGrowth$ runtime === RUN TestStackGrowth --- PASS: TestStackGrowth (2.61 seconds) === RUN TestStackGrowth-2 --- PASS: TestStackGrowth-2 (6.03 seconds) === RUN TestStackGrowth-4 --- PASS: TestStackGrowth-4 (7.94 seconds) === RUN TestStackGrowth-8 --- PASS: TestStackGrowth-8 (8.31 seconds) === RUN TestStackGrowth-12 --- PASS: TestStackGrowth-12 (8.39 seconds) === RUN TestStackGrowth-16 --- PASS: TestStackGrowth-16 (8.37 seconds) === RUN TestStackGrowth-24 --- PASS: TestStackGrowth-24 (8.45 seconds) === RUN TestStackGrowth-32 --- PASS: TestStackGrowth-32 (8.48 seconds) === RUN TestStackGrowth-48 --- PASS: TestStackGrowth-48 (8.54 seconds) PASS After: === RUN TestStackGrowth --- PASS: TestStackGrowth (2.67 seconds) === RUN TestStackGrowth-2 --- PASS: TestStackGrowth-2 (2.38 seconds) === RUN TestStackGrowth-4 --- PASS: TestStackGrowth-4 (2.71 seconds) === RUN TestStackGrowth-8 --- PASS: TestStackGrowth-8 (3.13 seconds) === RUN TestStackGrowth-12 --- PASS: TestStackGrowth-12 (3.06 seconds) === RUN TestStackGrowth-16 --- PASS: TestStackGrowth-16 (3.08 seconds) === RUN TestStackGrowth-24 --- PASS: TestStackGrowth-24 (2.95 seconds) === RUN TestStackGrowth-32 --- PASS: TestStackGrowth-32 (2.98 seconds) === RUN TestStackGrowth-48 --- PASS: TestStackGrowth-48 (3.09 seconds) Fixes issue 7763

Patch Set 1 #

Patch Set 2 : diff -r b3405f9c2e32 https://code.google.com/p/go #

Patch Set 3 : diff -r b3405f9c2e32 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -8 lines) Patch
M src/pkg/runtime/mgc0.c View 1 1 chunk +1 line, -4 lines 0 comments Download
M src/pkg/runtime/parfor.c View 1 1 chunk +1 line, -4 lines 0 comments Download

Messages

Total messages: 5
aram
Hello dvyukov (cc: golang-codereviews@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go
10 years ago (2014-04-12 10:25:56 UTC) #1
rsc
NOT LGTM Not for Go 1.3. Too late, sorry. It's really not a big deal ...
10 years ago (2014-04-14 00:06:41 UTC) #2
aram
I'm quite surprised by your response. I posted Linux/amd64 results. This shows a clear improvement ...
10 years ago (2014-04-14 09:19:55 UTC) #3
rsc
On Mon, Apr 14, 2014 at 5:19 AM, <aram@mgk.ro> wrote: > I'm quite surprised by ...
10 years ago (2014-04-14 14:12:41 UTC) #4
rsc
10 years ago (2014-04-17 02:54:53 UTC) #5
R=close

Let's pick this up for 1.4 (hg mail will reopen).
In general I think it is a mistake to remove the sleeps entirely.
What if you have two CPUs running two threads and the other thread is taking a
long time on the other CPU? Once you've yielded a few times without effect, it
seems silly to spin yielding instead of sleeping.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b