Re: arm64 swap-related question

From: Tomoaki AOKI <junchoon_at_dec.sakura.ne.jp>
Date: Mon, 29 Jan 2024 13:12:34 UTC
On Mon, 29 Jan 2024 12:48:21 +0000
void <void@f-m.fm> wrote:

> Hello,
> 
> What's the default granularity with swapping on recent -current 
> on arm64?
> 
> ie. whats the smallest size of data that is swapped out. 1k? 4k? Where
> can I find this info? Can it be set/tuned? How to see what it currently is?
> I'd like to set it to 32k if possible. Read performance on this disk 
> for swap tops out at 60MB/s with a 32k block size.
> 
> For bs=512 it's 1349 kB/s
> For bs=4k it's 11MB/s
> 
> context: the thing I'm trying to work around is poor swap performance 
> on this arch/hardware.
> -- 

You should read /usr/src/sys/vm/swap_pager.c. Keyword would PAGE_SIZE.
Then, look for its definition for arm64.

IIUC, swap is based on "paging" and once severe memory shortage
happens, swap out whole idle but not pinned processes with per-process
basis, and when it's not sufficient to keep OS running, OOM killer
whould look for which process to kill.

So PAGE_SIZE shold be the keyword for it.

HTH.

-- 
Tomoaki AOKI    <junchoon@dec.sakura.ne.jp>