LWN.net Logo

TuxOnIce: in from the cold?

By Jake Edge
May 13, 2009

As flamewars go, the recent linux-kernel thread about TuxOnIce was pretty tame. Likely weary of heated discussions in the past, the participants mostly swore off the flames with a bid to work together on Linux hibernation (i.e. suspend to disk). But, there still seems to be an impediment to that collaboration. The long out-of-tree history for TuxOnIce, combined with lead developer Nigel Cunningham's inability or unwillingness to work with the community means that TuxOnIce could have a bumpy road into the kernel—if it ever gets there at all.

TuxOnIce, formerly known as suspend2 and swsusp2, is a longstanding out-of-tree solution for hibernation. It has an enthusiastic user community along with some features not available in swsusp, which is the current mainline hibernation code. Some of the advantages claimed by TuxOnIce are support for multiple swap devices or regular files as the suspend image destination, better performance via compressed images and other techniques, saving nearly all of the contents of memory including caches, etc. But its vocal users say that the biggest advantage is that TuxOnIce just works for many—some of whom cannot get the current mainline mechanisms to work.

Much of the recent mainline hibernation work, generally done by Rafael Wysocki and Pavel Machek, has focused on uswsusp, which moves the bulk of the suspend work to user space. So, the kernel already contains two mechanisms for doing hibernation, leaving no real chance for a third to be added.

There are clear disagreements about how much and which parts should be in the kernel versus in user space. Machek seems to think that nearly all of the task can be handled in user space, while Cunningham is in favor of the advantages—performance and being able to take advantage of in-kernel interfaces—of an all kernel approach. Wysocki is somewhere in the middle, outlining some of the advantages he sees in the in-kernel solution:

One benefit is that we need not anything in the initrd for hibernation to work. Another one is that we can get superior performance, for obvious reasons (less copying of data, faster I/O). Yet another is simpler configuration and no need to maintain a separate set of user space tools. I probably could find more.

A bigger disconnect, though, is how to proceed. Cunningham would like to see TuxOnIce merged whole as a parallel alternative to swsusp, with an eye to eventually replacing and removing swsusp. Machek and Wysocki are not terribly interested in replacing swsusp, they would rather see incremental improvements—many coming from the TuxOnIce code—proposed and merged. On the one hand, Cunningham has an entire subsystem that he would like to see merged, while the swsusp folks have a subsystem—used by most distributions for hibernation—to maintain.

Cunningham recently posted an RFC for merging TuxOnIce "with a view to seeking to get it merged, perhaps in 2.6.31 or .32 (depending upon what needs work before it can be merged) and the willingness of those who matter". That was met with a somewhat heated reply by Machek. But Wysocki was quick to step in to try to avoid the flames:

Actually, I see advantages of working together versus fighting flame wars. Please stop that, I'm not going to take part in it this time.

After Cunningham agreed, the discussion turned to how to work together, which is where it seems to have hit an impasse. Wysocki and Cunningham, at least, see some clear advantages in the TuxOnIce code, but, contrary to Cunningham's wishes, having it merged wholesale is likely not in the cards. Cunningham describes his plan as follows:

I'd like to see use have all three [swsusp, uswsusp, and TuxOnIce] for one or two releases of vanilla, just to give time to work out any issues that haven't been foreseen. Once we're all that there are confident there are no regressions with TuxOnIce, I'd remove swsusp. That's my ideal plan of attack.

Not surprisingly, Wysocki and Machek see things differently. Machek is not opposed to bringing some of TuxOnIce into the mainline: "If we are talking about improving mainline to allow tuxonice functionality... then yes, that sounds reasonable." Wysocki lays out an alternative plan that is much more in keeping with traditional kernel development strategies:

So this is an idea to replace our current hibernation implementation with TuxOnIce.

Which unfortunately I don't agree with.

I think we can get _one_ implementation out of the three, presumably keeping the user space interface that will keep the current s2disk binaries happy, by merging TuxOnIce code _gradually_. No "all at once" approach, please.

And by "merging" I mean _exactly_ that. Not adding new code and throwing away the old one.

But, as Cunningham continues pushing for help in getting TuxOnIce merged alongside swsusp, Wysocki points out that it requires a great deal of review to get a huge (10,000+ lines of code) set of patches accepted: "That would take lot of work and we'd also have to ask many other busy people to do a lot of work for us". Cunningham seems to be under the misapprehension that kernel hackers will be willing to merge a subsystem that duplicates another without a clear overriding reason. Easing what he sees as a necessary transition from swsusp to TuxOnIce is not likely to be that compelling.

It is clearly frustrating for Cunningham to have a working solution but be unable to get it into the kernel. But it is a direct result of working out of the tree and then trying to present a solution when the kernel has gone in a different direction. It is a common mistake that folks make when dealing with the kernel community. Ray Lee provides a nice answer to Cunningham's frustrations, which points to IBM's device mapper contribution that suffered from a similar reaction. Lee notes that Wysocki has offered extremely valuable assistance:

He's offering to be the social glue between your code and the forms that are accepted and followed here on LKML. Taking things apart from the whole, finding the pieces that are non-controversial or easily argued for, getting them merged upstream with a user, and then moving on to the rest.

This way, the external TuxOnIce patch set shrinks and shrinks, until it's eventually gone, with all functionality merged into the kernel in one form or another.

Is your code better than uswsusp? Almost certainly. This isn't about that. This is about making your code better than what it is today, by going through the existing review-and-merge process.

At one point, Cunningham pointed to the SL*B memory allocators as an example of parallel implementations that are all available in the mainline. Various folks responded that memory allocators are fairly self-contained, unlike TuxOnIce. Furthermore, as Pekka Enberg notes: "Yes, so please don't make the same mistake we did. Once you have multiple implementations in the kernel, it's extremely hard to get rid of them."

There has been a bit of discussion about the technical aspects of the TuxOnIce patch, mostly centering on the way that it frees up memory to allow enough space to create a suspend image, while still adding the contents of that memory to the suspend image. By relying on existing kernel behavior, which is not necessarily guaranteed for the future, TuxOnIce can save nearly all of the memory contents, whereas swsusp dumps caches and the like to create enough memory to build the suspend image. That means that performance after a resume operation may be impacted as those caches are refilled. Overall, though, the main focus of the discussion has been the way forward; so far, there has been little progress on that front.

This is not the first time that TuxOnIce has gotten to this point. In its earlier guise as swsusp2, Cunningham made several attempts to get it into the mainline. In March of 2004, Andrew Morton asked that it be broken down into smaller, more easily digested, chunks. The same thing happened again near the end of 2004 when Cunningham proposed adding swsusp2 in one big code ball. It doesn't end there, either, between then and now the same request has been made; at this point one might guess that Cunningham simply isn't willing to do things that way.

There is a real danger that the TuxOnIce features that its users like could be lost—or remain out-of-tree—if something doesn't give. Either Cunningham has to recognize that the only plausible way to get TuxOnIce into the kernel is via the normal kernel development path, or someone else has to pick it up and start that process themselves. With no one (other than Cunningham) pushing for its inclusion, there simply is no other way for it to get into the mainline.


(Log in to post comments)

TuxOnIce: in from the cold?

Posted May 14, 2009 14:41 UTC (Thu) by nix (subscriber, #2304) [Link]

But it is a direct result of working out of the tree and then trying to present a solution when the kernel has gone in a different direction.
This disagrees with my memory of those old threads, which had Pavel creating uswsusp after Nigel proposed inclusion of what was then suspend2.

TuxOnIce: in from the cold?

Posted May 15, 2009 9:49 UTC (Fri) by hppnq (guest, #14462) [Link]

Exactly.

I still do not suspend, by the way. Or resume, rather. People who want to try TuxOnIce can probably find packages for their distribution, it seems. Maybe I should give it a try.

TuxOnIce: in from the cold?

Posted May 16, 2009 12:30 UTC (Sat) by bredelings (subscriber, #53082) [Link]

Um, yeah... Not only does suspend-to-disk still not work on my (recent Ubuntu) machine, my impression was that it was even less functional during the last push for TuxOnIce inclusion. LWN seems to have decided that the real issue is whether or not external patches are willing to follow the LK method of adding things... instead of whether or not a certain kernel subsystem maintainer is taking a "I got here first, so you have to do things MY way" approach. And LWN may be right. But it seems that perhaps the real hero is Wysocki for being so willing and able to work with both parties.

why uswsusp?

Posted May 21, 2009 15:16 UTC (Thu) by quartz (guest, #37351) [Link]

Same here, resume and suspend don't work. The article doesn't explain why we have uswsusp at all, instead of THAT having been merged into the old swsusp. did it work worse than swsusp?

why uswsusp?

Posted May 25, 2009 11:11 UTC (Mon) by forthy (guest, #1525) [Link]

I've more or less the same problems - we have a broken suspend system in the kernel, and an apparently much better system outside. Please dump the two non-working in-kernel systems, and replace them by the working one. And don't allow the maintainers of the broken systems that never get fixed to block the road.

Policies are often useful, but they aren't the law. Some parts have to be rewritten from scratch, or otherwise solved quite differently, so incremental change is not possible. If such a non-incremental change is impossible to Linux, it will eventually die a slow death - like Windows, which resists such changes for quite different reasons.

The article isn't fair

Posted May 21, 2009 20:32 UTC (Thu) by huaz (guest, #10168) [Link]

I've been watching LKML for many years.

It's not just that Nigel won't work with the communities. It's that he is frustrated that a superior solution is blocked because of one maintainer, Pavel.

Pavel was the original swsusp maintainer, and over the years he has not been able to make suspend-to-disk work reliably no matter how he sweet-plays the situation.

Rafael later joined, and he is better (both in professionalism and personality). But the fact remains: the in-kernel solution sucks.

Each time this topic came up, Pavel says "we can also do it (in user space, blahblah)”, but it's all vaporware.

There is no way IMO to improve it unless one of the following happens:
1. Find a better maintainer who is not so hooked up with the current code
2. Linus himself actually uses and cares about this feature

The article isn't fair

Posted May 21, 2009 22:14 UTC (Thu) by johill (subscriber, #25196) [Link]

Yet sadly, Rafael still listens to what Pavel says years later.

Copyright © 2009, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds