Page MenuHomeFreeBSD

Eliminate incorrect 2 pagesized block skipping while preparing swap device.
AbandonedPublic

Authored by ota_j.email.ne.jp on Jun 17 2019, 7:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Mar 5, 8:06 AM
Unknown Object (File)
Feb 11 2024, 9:36 PM
Unknown Object (File)
Feb 11 2024, 9:33 PM
Unknown Object (File)
Feb 11 2024, 7:02 PM
Unknown Object (File)
Jan 14 2024, 9:29 PM
Unknown Object (File)
Jan 2 2024, 7:35 AM
Unknown Object (File)
Dec 20 2023, 2:57 AM
Unknown Object (File)
Dec 13 2023, 3:39 AM

Details

Reviewers
dougm
alc
Summary

When a FreeBSD partition is passed, like /dev/ada0s1b, we are okay.

According to the comment, it looks like the code was to skip BSD label to prevent damages when a FreBSD slice, like dev/ada0s1, is passed. If that' done, swapping out will destroy FreeBSD partitions sooner or later anyway, skipping 8-k doesn't help much.

It looks this 2-page offset is passed incorrectly to some of blist() and/or page-in actions and results in system hung.

One can reproduce with with more than 2 swap devices easily. Fill out one swap device and "swapoff" filled one hangs forever. This can happen with a single swap device; however, if a single swap device is fully used,
the system is under slashing condition and it is very difficult to distinguish
between slashing and hanging/not-responding.

I replaced to use sw_nblks in some places to be explicit although nblks and sw_nblks are the same in most places.

Test Plan

Still testing to see if this completely eleminates swapoff(1) and page-in hungs.
D20674 fix helps to monitor greately with "systat -vm."

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 24903
Build 23633: arc lint + arc unit

Event Timeline

Most of these changes are distractions, unrelated to your real purpose. I suggest you get rid of them. What's left is you removing a bug fix from 2003 without any explanation about why that fix is no longer necessary, and you fixing a bug that hasn't been filed with no real explanation of how it is a fix. I don't think anyone has enough information to approve this change.

Please take a look at the latest comment on D20599. It shows that the two-page reservation is required to preserve the BSD label when the swap partition is the first partition within a slice. Therefore, I recommend that this proposed change be abandoned.

I wasn't aware of swap partition being the the first in a slice was the case. All of my swaps have been either one of whole device, whole slice or non-first partition, or NFS files. No wonder I never encountered any issues over years even with this change on my local tree.

There has been a problem with swap usage report such as sysctl -l and systat -swap that have been reporting wrong available size - each swap device is 2 pages larger than actually available.

I will update the comment, then.