Skip to content

Commit

Permalink
perf: gopool enable PreemptOff
Browse files Browse the repository at this point in the history
  • Loading branch information
joway committed Sep 20, 2023
1 parent a612b33 commit b52892f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions util/gopool/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ func newWorker() interface{} {
func (w *worker) run() {
go func() {
g := runtimex.GetG()
m := g.M()
p := m.P()
for {
var t *task
now := runtimex.Nanotime()
Expand All @@ -63,6 +61,8 @@ func (w *worker) run() {
return
}

m := g.M()
p := m.P()
// update sysmon tick
if w.updateSched {
st := *p.Sysmontick()
Expand All @@ -81,7 +81,9 @@ func (w *worker) run() {
logger.CtxErrorf(t.ctx, msg)
}
}
*(g.M().PreemptOff()) = ""
}()
*m.PreemptOff() = "holding"
t.f()
}()
t.Recycle()
Expand Down

0 comments on commit b52892f

Please sign in to comment.