Subject: Re: deadlock with sched_lock in SA code
To: Jason Thorpe <firstname.lastname@example.org>
From: Eric Haszlakiewicz <email@example.com>
Date: 08/28/2005 22:46:54
On Sun, Aug 28, 2005 at 12:20:11PM -0700, Jason Thorpe wrote:
> On Aug 28, 2005, at 8:17 AM, Chuck Silvers wrote:
> >allocating pages from UVM can call wakeup(), so we must avoid that
> >while holding sched_lock. one way to do this would be to call
> >sadata_upcall_alloc() before acquiring sched_lock and passing the
> >resulting pointer to sa_switch(), instead of calling that in
> >sa_switch() itself. does anyone have any better suggestions?
> >if not, I'll fix it that way.
> That sounds reasonable.
another option I was thinking of was to have UVM_KICK_PDAEMON
set an atomic flag that indicates the page daemon needs to be awakened,
which causes wakeup (or even directly sched_wakeup) to be called sometime
later. (say, in ltsleep) That'd also save a lock/unlock.
then again, that see more fragile, and maybe that's muddling the
distinction between the process scheduling code and the uvm code too much.