Re: Attempted summary of suspend-blockers LKML thread, take three

Alan Stern
2010-08-17T15:00:17Z

On Tue, 17 Aug 2010, Rafael J. Wysocki wrote:

> > In general, we try to keep such complexity out of the
> > kernel, but not always; there are compelling cases for putting
> > complexity in the kernel to provide uniformity and flexibility (e.g.
> > application state save/restore vs. system-wide checkpoints, the former
> > preserves the "if it can be done outside the kernel, it should be",
> > while the latter provides much greater flexibility and avoids the need
> > to port applications to potentially incompatible or unportable state
> > saves/restore libraries).
>
> I understand that and IMO it should be decided on the case-by-case basis.
> In this particular case, however, I don't think it's appropriate to use the
> interface designed with user space in mind for implementing a kernel-based
> mechanism.

Putting the "opportunistic suspend" loop into the kernel doesn't save
as much as one might think. The loop itself is quite simple, and the
task switch it entails is required in any case (since suspend must be
carried out within a process context). Putting it in the kernel would
save a few user/kernel context switches, not enough to matter IMO. And
it wouldn't offer any greater flexibility -- it might even cut down the
flexibility.

Alan Stern