@@ -663,59 +663,6 @@ func ready(gp *g, traceskip int, next bool) {
663
663
}
664
664
}
665
665
666
- func gcprocs () int32 {
667
- // Figure out how many CPUs to use during GC.
668
- // Limited by gomaxprocs, number of actual CPUs, and MaxGcproc.
669
- lock (& sched .lock )
670
- n := gomaxprocs
671
- if n > ncpu {
672
- n = ncpu
673
- }
674
- if n > _MaxGcproc {
675
- n = _MaxGcproc
676
- }
677
- if n > sched .nmidle + 1 { // one M is currently running
678
- n = sched .nmidle + 1
679
- }
680
- unlock (& sched .lock )
681
- return n
682
- }
683
-
684
- func needaddgcproc () bool {
685
- lock (& sched .lock )
686
- n := gomaxprocs
687
- if n > ncpu {
688
- n = ncpu
689
- }
690
- if n > _MaxGcproc {
691
- n = _MaxGcproc
692
- }
693
- n -= sched .nmidle + 1 // one M is currently running
694
- unlock (& sched .lock )
695
- return n > 0
696
- }
697
-
698
- func helpgc (nproc int32 ) {
699
- _g_ := getg ()
700
- lock (& sched .lock )
701
- pos := 0
702
- for n := int32 (1 ); n < nproc ; n ++ { // one M is currently running
703
- if allp [pos ].mcache == _g_ .m .mcache {
704
- pos ++
705
- }
706
- mp := mget ()
707
- if mp == nil {
708
- throw ("gcprocs inconsistency" )
709
- }
710
- mp .helpgc = n
711
- mp .p .set (allp [pos ])
712
- mp .mcache = allp [pos ].mcache
713
- pos ++
714
- notewakeup (& mp .park )
715
- }
716
- unlock (& sched .lock )
717
- }
718
-
719
666
// freezeStopWait is a large value that freezetheworld sets
720
667
// sched.stopwait to in order to request that all Gs permanently stop.
721
668
const freezeStopWait = 0x7fffffff
@@ -1132,11 +1079,6 @@ func stopTheWorldWithSema() {
1132
1079
}
1133
1080
}
1134
1081
1135
- func mhelpgc () {
1136
- _g_ := getg ()
1137
- _g_ .m .helpgc = - 1
1138
- }
1139
-
1140
1082
func startTheWorldWithSema (emitTraceEvent bool ) int64 {
1141
1083
_g_ := getg ()
1142
1084
@@ -1145,7 +1087,6 @@ func startTheWorldWithSema(emitTraceEvent bool) int64 {
1145
1087
list := netpoll (false ) // non-blocking
1146
1088
injectglist (& list )
1147
1089
}
1148
- add := needaddgcproc ()
1149
1090
lock (& sched .lock )
1150
1091
1151
1092
procs := gomaxprocs
@@ -1175,7 +1116,6 @@ func startTheWorldWithSema(emitTraceEvent bool) int64 {
1175
1116
} else {
1176
1117
// Start M to run P. Do not start another M below.
1177
1118
newm (nil , p )
1178
- add = false
1179
1119
}
1180
1120
}
1181
1121
@@ -1192,16 +1132,6 @@ func startTheWorldWithSema(emitTraceEvent bool) int64 {
1192
1132
wakep ()
1193
1133
}
1194
1134
1195
- if add {
1196
- // If GC could have used another helper proc, start one now,
1197
- // in the hope that it will be available next time.
1198
- // It would have been even better to start it before the collection,
1199
- // but doing so requires allocating memory, so it's tricky to
1200
- // coordinate. This lazy approach works out in practice:
1201
- // we don't mind if the first couple gc rounds don't have quite
1202
- // the maximum number of procs.
1203
- newm (mhelpgc , nil )
1204
- }
1205
1135
_g_ .m .locks --
1206
1136
if _g_ .m .locks == 0 && _g_ .preempt { // restore the preemption request in case we've cleared it in newstack
1207
1137
_g_ .stackguard0 = stackPreempt
@@ -1276,10 +1206,7 @@ func mstart1() {
1276
1206
fn ()
1277
1207
}
1278
1208
1279
- if _g_ .m .helpgc != 0 {
1280
- _g_ .m .helpgc = 0
1281
- stopm ()
1282
- } else if _g_ .m != & m0 {
1209
+ if _g_ .m != & m0 {
1283
1210
acquirep (_g_ .m .nextp .ptr ())
1284
1211
_g_ .m .nextp = 0
1285
1212
}
@@ -2003,21 +1930,11 @@ func stopm() {
2003
1930
throw ("stopm spinning" )
2004
1931
}
2005
1932
2006
- retry:
2007
1933
lock (& sched .lock )
2008
1934
mput (_g_ .m )
2009
1935
unlock (& sched .lock )
2010
1936
notesleep (& _g_ .m .park )
2011
1937
noteclear (& _g_ .m .park )
2012
- if _g_ .m .helpgc != 0 {
2013
- // helpgc() set _g_.m.p and _g_.m.mcache, so we have a P.
2014
- gchelper ()
2015
- // Undo the effects of helpgc().
2016
- _g_ .m .helpgc = 0
2017
- _g_ .m .mcache = nil
2018
- _g_ .m .p = 0
2019
- goto retry
2020
- }
2021
1938
acquirep (_g_ .m .nextp .ptr ())
2022
1939
_g_ .m .nextp = 0
2023
1940
}
@@ -3857,7 +3774,7 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) {
3857
3774
pc = funcPC (_ExternalCode ) + sys .PCQuantum
3858
3775
}
3859
3776
stk [0 ] = pc
3860
- if mp .preemptoff != "" || mp . helpgc != 0 {
3777
+ if mp .preemptoff != "" {
3861
3778
stk [1 ] = funcPC (_GC ) + sys .PCQuantum
3862
3779
} else {
3863
3780
stk [1 ] = funcPC (_System ) + sys .PCQuantum
@@ -4634,7 +4551,7 @@ func schedtrace(detailed bool) {
4634
4551
if lockedg != nil {
4635
4552
id3 = lockedg .goid
4636
4553
}
4637
- print (" M" , mp .id , ": p=" , id1 , " curg=" , id2 , " mallocing=" , mp .mallocing , " throwing=" , mp .throwing , " preemptoff=" , mp .preemptoff , "" + " locks=" , mp .locks , " dying=" , mp .dying , " helpgc=" , mp . helpgc , " spinning=" , mp .spinning , " blocked=" , mp .blocked , " lockedg=" , id3 , "\n " )
4554
+ print (" M" , mp .id , ": p=" , id1 , " curg=" , id2 , " mallocing=" , mp .mallocing , " throwing=" , mp .throwing , " preemptoff=" , mp .preemptoff , "" + " locks=" , mp .locks , " dying=" , mp .dying , " spinning=" , mp .spinning , " blocked=" , mp .blocked , " lockedg=" , id3 , "\n " )
4638
4555
}
4639
4556
4640
4557
lock (& allglock )
0 commit comments