Skip to content

Commit fbd54f5

Browse files
authored
Merge branch 'golang:master' into feature/VMkernel-support
2 parents 12c6a2b + f967078 commit fbd54f5

File tree

6 files changed

+14
-4
lines changed

6 files changed

+14
-4
lines changed

src/os/root_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,9 @@ func TestRootChtimes(t *testing.T) {
457457
case "js", "plan9":
458458
times.atime = times.atime.Truncate(1 * time.Second)
459459
times.mtime = times.mtime.Truncate(1 * time.Second)
460+
case "illumos":
461+
times.atime = times.atime.Truncate(1 * time.Microsecond)
462+
times.mtime = times.mtime.Truncate(1 * time.Microsecond)
460463
}
461464

462465
err := root.Chtimes(test.open, times.atime, times.mtime)

src/runtime/asan.go

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ func ASanWrite(addr unsafe.Pointer, len int) {
2626

2727
// Private interface for the runtime.
2828
const asanenabled = true
29+
const asanenabledBit = 1
2930

3031
// asan{read,write} are nosplit because they may be called between
3132
// fork and exec, when the stack must not grow. See issue #50391.

src/runtime/asan0.go

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
)
1414

1515
const asanenabled = false
16+
const asanenabledBit = 0
1617

1718
// Because asanenabled is false, none of these functions should be called.
1819

src/runtime/lock_spinbit.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ type mWaitList struct {
9090

9191
// lockVerifyMSize confirms that we can recreate the low bits of the M pointer.
9292
func lockVerifyMSize() {
93-
size := roundupsize(unsafe.Sizeof(m{}), false) + mallocHeaderSize
93+
size := roundupsize(unsafe.Sizeof(mPadded{}), false) + mallocHeaderSize
9494
if size&mutexMMask != 0 {
9595
print("M structure uses sizeclass ", size, "/", hex(size), " bytes; ",
9696
"incompatible with mutex flag mask ", hex(mutexMMask), "\n")

src/runtime/proc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2256,7 +2256,7 @@ func allocm(pp *p, fn func(), id int64) *m {
22562256
unlock(&sched.lock)
22572257
}
22582258

2259-
mp := new(m)
2259+
mp := &new(mPadded).m
22602260
mp.mstartfn = fn
22612261
mcommoninit(mp, id)
22622262

src/runtime/runtime2.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -619,13 +619,18 @@ type m struct {
619619
// Up to 10 locks held by this m, maintained by the lock ranking code.
620620
locksHeldLen int
621621
locksHeld [10]heldLockInfo
622+
}
623+
624+
const mRedZoneSize = (16 << 3) * asanenabledBit // redZoneSize(2048)
625+
626+
type mPadded struct {
627+
m
622628

623629
// Size the runtime.m structure so it fits in the 2048-byte size class, and
624630
// not in the next-smallest (1792-byte) size class. That leaves the 11 low
625631
// bits of muintptr values available for flags, as required for
626632
// GOEXPERIMENT=spinbitmutex.
627-
_ [goexperiment.SpinbitMutexInt * 64 * goarch.PtrSize / 8]byte
628-
_ [goexperiment.SpinbitMutexInt * 700 * (2 - goarch.PtrSize/4)]byte
633+
_ [goexperiment.SpinbitMutexInt * (2048 - mallocHeaderSize - mRedZoneSize - unsafe.Sizeof(m{}))]byte
629634
}
630635

631636
type p struct {

0 commit comments

Comments
 (0)