Page MenuHomeFreeBSD

Use enumeration to indicate swap almost full and full, instead of 2 variables.
Needs ReviewPublic

Authored by ota_j.email.ne.jp on Oct 12 2019, 2:07 AM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 3 2023, 1:38 PM
Unknown Object (File)
Aug 21 2023, 2:50 AM
Unknown Object (File)
May 23 2023, 7:07 AM
Unknown Object (File)
Jan 13 2023, 2:08 AM
Unknown Object (File)
Nov 29 2022, 12:00 AM
Subscribers

Details

Reviewers
kib
markj
alc
dougm
Summary

Use enumeration to indicate usage level of swap space and simplify code.

Both high and low watermark are too low at today's hardware, like 1 ~ 10 GB
while it was large enough numbers 20 years ago 16 ~ 64 MB.
I'd like to propose to change 1/16 as high watermark and 1/32 as low one
to adjust at swapon time (as a separate and next changeset.)

Test Plan

Use all swap spaces to trigger "swap_pager: almost out of swap" print out.

Diff Detail

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

Event Timeline

sys/vm/swap_pager.c
482–485

How about "== SWPG_LOW"?

489

Why is this line necessary?

768

Does this line really compile? It looks about 3 arguments short.

Use "== SWPG_LOW" comparison for almost full warning.
Drop swp_gauge > SWPG_LOW comparison for high watermark check.

sys/vm/swap_pager.c
488

How about if swap_pager_avail >= nswap_lowat and swap_pager_avail <= nswap_hiwat? You are changing that behavior.

ota_j.email.ne.jp added inline comments.
sys/vm/swap_pager.c
488

That's a case when we reset SWPG_FULL status.

Page in/out doesn't happen over (512-128) size block and system will hit the other cases.
So, I think in order to hit this range with SWPG_FULL, one needs to swap on/off a couple of MB swap devices.
Given today's physical memory is in the unit of GB, a couple of MB swap won't save the system.

I think we are okay as is for now.

Or I can add else case to the top if-elseif like following:
else {

if(swp_gauge == SWPG_FULL)
    swp_gauge = SWPG_LOW;

}

What do you think?

freqlabs added inline comments.
sys/vm/swap_pager.c
326

Please add comments describing what each of these means.