mirror of https://github.com/golang/go.git
runtime: use built-in min function
This commit is contained in:
parent
d60a684c87
commit
779f756850
|
|
@ -6636,20 +6636,14 @@ func globrunqget() *g {
|
|||
|
||||
// Try get a batch of G's from the global runnable queue.
|
||||
// sched.lock must be held.
|
||||
func globrunqgetbatch(max int32) (gp *g, q gQueue, qsize int32) {
|
||||
func globrunqgetbatch(n int32) (gp *g, q gQueue, qsize int32) {
|
||||
assertLockHeld(&sched.lock)
|
||||
|
||||
if sched.runqsize == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
n := sched.runqsize/gomaxprocs + 1
|
||||
if n > sched.runqsize {
|
||||
n = sched.runqsize
|
||||
}
|
||||
if n > max {
|
||||
n = max
|
||||
}
|
||||
n = min(n, sched.runqsize, sched.runqsize/gomaxprocs+1)
|
||||
|
||||
sched.runqsize -= n
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue