runtime: use built-in min function

This commit is contained in:
Marcel Meyer 2025-04-10 16:36:27 +02:00
parent d60a684c87
commit 779f756850
No known key found for this signature in database
1 changed files with 2 additions and 8 deletions

View File

@ -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