Re: Helping drivers to work without the freezer

Pavel Machek
2008-03-10T13:05:41Z

Hi!

> > Well, to me, rwsem sounds definitely better. Still, I think it's better to
> > avoid locking it for too long, so we could use a variable protected by the
> > rwsem such that if it's 'true', unsleepable tasks checking it will put
> > themselves into a wait queue which will be woken up by the PM core
> > during resume.
>
> Isn't that exactly what an rwsem does? When it is locked for writing
> (your flag is "true"), tasks attempting to get a read lock will put
> themselves into a wait queue which will be woken up when the write lock
> is released (when the PM core sets the flag to "false" during resume).
>
> In this case we could use something a little simpler than a
> general-purpose rwsem, since there will never be more than one task
> getting a write lock at any time -- i.e., never more than one task
> carrying out a system sleep. It's not hard to design such a simplified
> rwsem in a way that exerts virtually no overhead on readers whenever no
> writer is present.

Just use generic rwsem... if we can see performance impact, we can
optimize it later.

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html