9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] modification to sleep in changeset 285df38d5ed3
@ 2020-12-21  4:33 Anthony Martin
  2020-12-21 13:08 ` cinap_lenrek
  0 siblings, 1 reply; 2+ messages in thread
From: Anthony Martin @ 2020-12-21  4:33 UTC (permalink / raw)
  To: 9front

Is it safe to call procsave after unlocking
the process and the rendezvous in sleep?

Cheers,
  Anthony

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9front] modification to sleep in changeset 285df38d5ed3
  2020-12-21  4:33 [9front] modification to sleep in changeset 285df38d5ed3 Anthony Martin
@ 2020-12-21 13:08 ` cinap_lenrek
  0 siblings, 0 replies; 2+ messages in thread
From: cinap_lenrek @ 2020-12-21 13:08 UTC (permalink / raw)
  To: 9front

> Is it safe to call procsave after unlocking
> the process and the rendezvous in sleep?

yeah, i dont see any problem. the only thing that
holding Proc.rlock prevents is that someone doing
a wakeup() of the process, which basically does
a ready() on it, putting it back on the run queue.

procsave() itself doesnt change the process
state and doesnt block/sleep itself.

having the process on the run queue while it
executes procsave() shouldnt be an issue.
the scheduler cannot dequeue it until the
process has set up->mp = nil, which happens
after procsave() in schedinit() when the
scheduler stacks have been switched.

also note that procsave is also executed without
any locks when we call sched(). which is called
for example when a qlock() goes to sleep.

theres nothing there preventing the process
that is commited to sleep to be immediately
re-awakend by someone else as soon as qlock
releases the Qlock.use spinlock.

--
cinap

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-21 13:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21  4:33 [9front] modification to sleep in changeset 285df38d5ed3 Anthony Martin
2020-12-21 13:08 ` cinap_lenrek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).