Bug 211466 - swapoff should not be called on reboot
Summary: swapoff should not be called on reboot
Status: Closed DUPLICATE of bug 187081
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 10.3-STABLE
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-30 19:09 UTC by Mikhail T.
Modified: 2016-10-02 21:19 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail T. 2016-07-30 19:09:09 UTC
When an orderly reboot is requested, the system attempts to remove the existing swap-areas by calling swapoff.

This seems unnecessary, may take a long time, and may even fail depending on the RAM-amount and usage.

This is, probably, due to the swap "service" being asked to "stop". Either it should not be asked to stop during reboot, or it should not attempt a swapoff in such a situation...
Comment 1 Jilles Tjoelker freebsd_committer freebsd_triage 2016-07-30 21:46:32 UTC
It actually works such that /etc/rc.d/swap does not remove swap on shutdown while /etc/rc.d/swaplate does. This seems reasonable to me, since late swap devices might become unavailable due to further rc.d stop operations which would cause userland crashes, while regular swap devices can be assumed to remain available throughout the shutdown process.

It would be good to start big daemons after swaplate starts and stop them before swaplate stops, so the extra swap is available to them and the I/O from swapoff is minimized. I don't know whether this is the case.

Before running rc.shutdown, init softly kills sessions from /etc/ttys (via SIGHUP to the main process and revoke(2)). This may not be very helpful these days where much is started from rc instead.
Comment 2 Jilles Tjoelker freebsd_committer freebsd_triage 2016-10-02 21:19:37 UTC
My analysis was wrong in that /etc/rc.d/swaplate's stop operation is not limited to late swap devices. A fix is being developed in 187081.

*** This bug has been marked as a duplicate of bug 187081 ***