On Mon, 27 Jan 2020 20:04:51 -0000 (UTC), Martin Gregorie
declaimed the following:
>I don't recall how big the swap file is when its initially created,
>mainly because I use swap partitions on all my systems except the RPi.
>You set the swap partition size when you create it and its size doesn't
>change unless you replace it with a different sized swap partition.
>
Everything I've found in Google implies that one first allocates a file
of known size (cf:
https://help.ubuntu.com/community/SwapFaq#How_do_I_add_a_swap_file.3F )
which sort of indicates that it does not grow dynamically.
>However, I think you'll find that the swap file is expanded if the kernel
>runs out of space in it but it is never automatically reduced in size,
>because the kernel can't know whether the workload that caused the
>increase was a one-off or just the first instance of the system's normal
>workload.
That sounds more like Windows behavior, where swap files are given an
initial size, and a maximum size (I think I normally make Windows swap a
fixed size since the OS can allocate a contiguous chunk of disk, rather
than risk a "split" swap).
And that brings up the biggest problem with a Linux swap file -- it is
likely not going to be contiguous even on disk AND if on an SD card (or
other flash media -- even an SSD can be killed by a system that is swapping
heavily)... Flash memory behavior means that it is likely every page swap
to SD card will trigger a new allocation unit erase/write cycle and wear
leveling means nothing is contiguous.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|