golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124k stars 17.67k forks source link

runtime: merge workarounds to false deadlocks #40518

Open prattmic opened 4 years ago

prattmic commented 4 years ago

In #40368, I avoided false deadlocks from startm in sysmon by reserving M ids in advance to make it look like the new M is already running to checkdead.

Later, I discovered that @dvyukov fixed a nearly identical issue in #6070 by temporarily decrementing the number of idle locked M's, to make checkdead see an extra M. Slightly different approach, but same end result.

We should merge these two approaches back to one just to keep things simpler and easier to understand.

cc @aclements @mknyszek @ianlancetaylor

aclements commented 4 years ago

With your change to startm to reserve an ID while holding sched.lock, is the logic in sysmon even necessary?

prattmic commented 4 years ago

I'm almost certain that the incidlelocked logic in sysmon is unnecessary after my change. There is similar logic in retake that I'll need to look at more closely.

aclements commented 3 years ago

Bumping to 1.17, but @prattmic, please bump to Backlog if you don't plan on working on this in 1.17.

ianlancetaylor commented 3 years ago

@prattmic Is anything going to happen in 1.17? If not, we should change the milestone to Backlog. Thanks.