Russ Cox | 1 Jul 2011 01:12
Favicon

parallel stop-the-world garbage collection

I cleaned up the remaining code from my go-gc fork
and integrated it into the current Go tree.  It still
stops the world during garbage collection but if there
are extra procs lying around idle, it will use them
(up to GOMAXPROCS) to parallelize both the mark
and the sweep phases.

There is a CL at http://codereview.appspot.com/4641082.
It is not ready for review, and it only runs on linux/amd64
because that is the only platform I bothered to implement
usleep on.

One thing I've noticed is that while programs do get a
little faster, the total user time increases by much more
than the saved real time.  Even making the busy loops
give up and do timed sleeps after the first few iterations
doesn't help - it's not spinning that is the problem, but
there is a problem.  For example, the test/bench/parser
program has these times when I vary the number of
cores the collector can use on a 16-core machine:

1 38.0u 38.8r
2 44.6u 35.2r
3 47.8u 32.8r
4 56.6u 33.6r
5 53.9u 33.0r
6 51.0u 32.0r
7 53.9u 33.4r
8 54.0u 32.9r

(Continue reading)

Paul Borman | 1 Jul 2011 01:29
Picon
Favicon

Re: parallel stop-the-world garbage collection

I am assuming these are Nehalem CPUs and you have more than one multi-core CPU?  Nehalem has a downside in its memory architecture.  Memory is attached to one of the CPUs.  It is rather expensive to switch owner of memory from one CPU to another (the fact that some memory is actually local and some is remote is not the biggest factor).  Having two cores on different CPU's hitting a compare and swap can kill you in much worse ways than doing it on two cores of the same CPU.  Of course, as you point out, any sort of contention really kills parallel operations...

On Thu, Jun 30, 2011 at 4:12 PM, Russ Cox <rsc-iFWiy5xATs8dnm+yROfE0A@public.gmane.org> wrote:
I cleaned up the remaining code from my go-gc fork
and integrated it into the current Go tree.  It still
stops the world during garbage collection but if there
are extra procs lying around idle, it will use them
(up to GOMAXPROCS) to parallelize both the mark
and the sweep phases.

There is a CL at http://codereview.appspot.com/4641082.
It is not ready for review, and it only runs on linux/amd64
because that is the only platform I bothered to implement
usleep on.

One thing I've noticed is that while programs do get a
little faster, the total user time increases by much more
than the saved real time.  Even making the busy loops
give up and do timed sleeps after the first few iterations
doesn't help - it's not spinning that is the problem, but
there is a problem.  For example, the test/bench/parser
program has these times when I vary the number of
cores the collector can use on a 16-core machine:

1 38.0u 38.8r
2 44.6u 35.2r
3 47.8u 32.8r
4 56.6u 33.6r
5 53.9u 33.0r
6 51.0u 32.0r
7 53.9u 33.4r
8 54.0u 32.9r

Beyond 3 cores is not really helpful, though it does chew
up cpu.  I've seen similar results with other programs.
It's not clear to me that paying 6.6 seconds to save 3.6 or
9.8 to save 6.0 is a worthwhile tradeoff.  15 to save 6 is
definitely not.

Perhaps the difference is that once 4+ cores are involved
the compare-and-swaps to update the mark bits are nearly
always having to fight over the cache line with other cpus?

The code is on Rietveld if you want to play (on linux/amd64
unless you want to implement usleep for your platform).

Russ

mattn.jp | 1 Jul 2011 02:04
Picon
Gravatar

Re: code review 4532093: goinstall: add support patch-tag.com (issue4532093)

*** Abandoned ***

http://codereview.appspot.com/4532093/

adg | 1 Jul 2011 02:06
Favicon

Re: code review 4642049: goinstall: documentation for new remote repository behavior (issue4642049)


http://codereview.appspot.com/4642049/diff/6001/src/cmd/goinstall/doc.go
File src/cmd/goinstall/doc.go (right):

http://codereview.appspot.com/4642049/diff/6001/src/cmd/goinstall/doc.go#newcode8
src/cmd/goinstall/doc.go:8: It maintains a list of public Go packages at
http://godashboard.appspot.com/package.
On 2011/06/30 11:50:00, quantumfyre wrote:
> Do we need some extra words to explain that only "public" packages are
reported
> to the dashboard?

Done.

http://codereview.appspot.com/4642049/diff/6001/src/cmd/goinstall/doc.go#newcode76
src/cmd/goinstall/doc.go:76: Search for a Mercurial repository at
"http://example.org/user/foo" or
On 2011/06/30 11:50:00, quantumfyre wrote:
> Should probably put http://example.org/user/foo.hg first, since that's
what the
> code will actually try first.

Done, in that I reversed the order in the code.

http://codereview.appspot.com/4642049/

mattn.jp | 1 Jul 2011 02:14
Picon
Gravatar

code review 4667051: cmd/goinstall: try to access via https. (issue4667051)

Reviewers: golang-dev_googlecode.com,

Message:
Hello golang-dev@... (cc: golang-dev@...),

I'd like you to review this change to
http://go.googlecode.com/hg/

Description:
cmd/goinstall: try to access via https.

Please review this at http://codereview.appspot.com/4667051/

Affected files:
   M src/cmd/goinstall/download.go

Index: src/cmd/goinstall/download.go
===================================================================
--- a/src/cmd/goinstall/download.go
+++ b/src/cmd/goinstall/download.go
 <at>  <at>  -77,7 +77,7  <at>  <at> 
  	logLimitFlag:      "-l1",
  	logReleaseFlag:    "-rrelease",
  	check:             "identify",
-	protocols:         []string{"http"},
+	protocols:         []string{"https", "http"},
  	suffix:            ".hg",
  	defaultHosts: []host{
  		 
{regexp.MustCompile(`^([a-z0-9\-]+\.googlecode\.com/hg)(/[a-z0-9A-Z_.\-/]*)?$`), "https", ""},
 <at>  <at>  -98,7 +98,7  <at>  <at> 
  	logLimitFlag:      "",
  	logReleaseFlag:    "release",
  	check:             "peek-remote",
-	protocols:         []string{"git", "http"},
+	protocols:         []string{"git", "https", "http"},
  	suffix:            ".git",
  	defaultHosts: []host{
  		

{regexp.MustCompile(`^(github\.com/[a-z0-9A-Z_.\-]+/[a-z0-9A-Z_.\-]+)(/[a-z0-9A-Z_.\-/]*)?$`),
"http", ".git"},
 <at>  <at>  -117,7 +117,7  <at>  <at> 
  	logLimitFlag:      "-l1",
  	logReleaseFlag:    "release",
  	check:             "info",
-	protocols:         []string{"http", "svn"},
+	protocols:         []string{"https", "http", "svn"},
  	suffix:            ".svn",
  	defaultHosts: []host{
  		 
{regexp.MustCompile(`^([a-z0-9\-]+\.googlecode\.com/svn)(/[a-z0-9A-Z_.\-/]*)?$`), "https", ""},
 <at>  <at>  -138,7 +138,7  <at>  <at> 
  	logLimitFlag:      "-l1",
  	logReleaseFlag:    "-rrelease",
  	check:             "info",
-	protocols:         []string{"http", "bzr"},
+	protocols:         []string{"https", "http", "bzr"},
  	suffix:            ".bzr",
  	defaultHosts: []host{
  		 
{regexp.MustCompile(`^(launchpad\.net/([a-z0-9A-Z_.\-]+(/[a-z0-9A-Z_.\-]+)?| 
~[a-z0-9A-Z_.\-]+/(\+junk| 
[a-z0-9A-Z_.\-]+)/[a-z0-9A-Z_.\-]+))(/[a-z0-9A-Z_.\-/]+)?$`), "https", ""},

dsymonds | 1 Jul 2011 02:48
Favicon
Gravatar

Re: code review 4603050: http: warn if the default Content-Type is known to be i... (issue4603050)

*** Abandoned ***

http://codereview.appspot.com/4603050/

dsymonds | 1 Jul 2011 03:01
Favicon
Gravatar

code review 4629089: goprotobuf: Fix bug in packed slice decoding. (issue4629089)

Reviewers: adg,

Message:
Hello adg (cc: golang-dev@...),

I'd like you to review this change to
https://goprotobuf.googlecode.com/hg

Description:
goprotobuf: Fix bug in packed slice decoding.

Please review this at http://codereview.appspot.com/4629089/

Affected files:
   M proto/decode.go

Index: proto/decode.go
===================================================================
--- a/proto/decode.go
+++ b/proto/decode.go
 <at>  <at>  -420,17 +420,6  <at>  <at> 
  	sp.Cap = startSize
  }

-// Make *pslice have base address base, length 0, and capacity  
max(startSize, n).
-func initSlicen(pslice unsafe.Pointer, base uintptr, n int) {
-	if n < startSize {
-		n = startSize
-	}
-	sp := (*reflect.SliceHeader)(pslice)
-	sp.Data = base
-	sp.Len = 0
-	sp.Cap = n
-}
-
  // Individual type decoders
  // For each,
  //	u is the decoded value,
 <at>  <at>  -538,10 +527,7  <at>  <at> 

  	y := *x
  	if cap(y) == 0 {
-		// Packed fields are usually only encoded once,
-		// so this branch is almost always executed.
-		// The append in the loop below takes care of other cases.
-		initSlicen(unsafe.Pointer(x), sbase+p.scratch, nb)
+		initSlice(unsafe.Pointer(x), sbase+p.scratch)
  		y = *x
  	}

 <at>  <at>  -587,10 +573,7  <at>  <at> 

  	y := *x
  	if cap(y) == 0 {
-		// Packed fields are usually only encoded once,
-		// so this branch is almost always executed.
-		// The append in the loop below takes care of other cases.
-		initSlicen(unsafe.Pointer(x), sbase+p.scratch, nb)
+		initSlice(unsafe.Pointer(x), sbase+p.scratch)
  		y = *x
  	}

 <at>  <at>  -637,10 +620,7  <at>  <at> 

  	y := *x
  	if cap(y) == 0 {
-		// Packed fields are usually only encoded once,
-		// so this branch is almost always executed.
-		// The append in the loop below takes care of other cases.
-		initSlicen(unsafe.Pointer(x), sbase+p.scratch, nb)
+		initSlice(unsafe.Pointer(x), sbase+p.scratch)
  		y = *x
  	}

adg | 1 Jul 2011 03:07
Favicon

Re: code review 4629089: goprotobuf: Fix bug in packed slice decoding. (issue4629089)

LGTM

http://codereview.appspot.com/4629089/

dsymonds | 1 Jul 2011 03:08
Favicon
Gravatar

Re: code review 4629089: goprotobuf: Fix bug in packed slice decoding. (issue4629089)

*** Submitted as
http://code.google.com/p/goprotobuf/source/detail?r=97d694cc53c9 ***

goprotobuf: Fix bug in packed slice decoding.

R=adg
CC=golang-dev
http://codereview.appspot.com/4629089

http://codereview.appspot.com/4629089/

dsymonds | 1 Jul 2011 03:14
Favicon
Gravatar

code review 4631082: goprotobuf: Revert part of 39eef1b13365. (issue4631082)

Reviewers: adg,

Message:
Hello adg (cc: golang-dev@...),

I'd like you to review this change to
https://goprotobuf.googlecode.com/hg

Description:
goprotobuf: Revert part of 39eef1b13365.

This gets goprotobuf working with release.r58.
After tagging, I'll revert this change.

Please review this at http://codereview.appspot.com/4631082/

Affected files:
   M proto/properties.go

Index: proto/properties.go
===================================================================
--- a/proto/properties.go
+++ b/proto/properties.go
 <at>  <at>  -109,8 +109,8  <at>  <at> 
  	dec     decoder
  	valDec  valueDecoder // set for bool and numeric types only
  	scratch uintptr
-	sizeof  uintptr // calculations of scratch space
-	alignof uintptr
+	sizeof  int // calculations of scratch space
+	alignof int

  	// If this is a packable field, this will be the decoder for the packed  
version of the field.
  	packedDec decoder
 <at>  <at>  -483,7 +483,7  <at>  <at> 
  		}
  		scratch = align(scratch, p.alignof)
  		p.scratch = scratch
-		scratch += p.sizeof
+		scratch += uintptr(p.sizeof)
  		prop.tags[p.Tag] = i
  	}
  	prop.reqCount = reqCount
 <at>  <at>  -496,7 +496,7  <at>  <at> 

  // Alignment of the data in the scratch area.  It doesn't have to be
  // exact, just conservative.  Returns the first number >= o that divides s.
-func align(o uintptr, s uintptr) uintptr {
+func align(o uintptr, s int) uintptr {
  	if s != 0 {
  		for o%uintptr(s) != 0 {
  			o++


Gmane