Re: git: 636592343c3e - main - tmpfs: increase memory reserve to a percent of available memory + swap

From: Jessica Clarke <jrtc27_at_freebsd.org>
Date: Mon, 22 Jan 2024 03:27:57 UTC
On 19 Dec 2023, at 15:34, Mike Karels <karels@FreeBSD.org> wrote:
> 
> The branch main has been updated by karels:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=636592343c3ec0feb61a4d8043676381384420dd
> 
> commit 636592343c3ec0feb61a4d8043676381384420dd
> Author:     Mike Karels <karels@FreeBSD.org>
> AuthorDate: 2023-12-19 15:33:33 +0000
> Commit:     Mike Karels <karels@FreeBSD.org>
> CommitDate: 2023-12-19 15:33:33 +0000
> 
>    tmpfs: increase memory reserve to a percent of available memory + swap
> 
>    The tmpfs memory reserve defaulted to 4 MB, and other than that,
>    all of available memory + swap could be allocated to tmpfs files.
>    This was dangerous, as the page daemon attempts to keep some memory
>    free, using up swap, and then resulting in processes being killed.
>    Increase the reserve to a fraction of available memory + swap at
>    file system startup time.  The limit is expressed as a percentage
>    of available memory + swap that can be used, and defaults to 95%.
>    The percentage can be changed via the vfs.tmpfs.memory_percent sysctl,
>    recomputing the reserve with the new percentage but the initial
>    available memory + swap.  Note that the reserve can also be set
>    directly with an existing sysctl, ignoring the percentage.  The
>    previous behavior can be specified by setting vfs.tmpfs.memory_percent
>    to 100.
> 
>    Add sysctl for vfs.tmpfs.memory_percent and the pre-existing
>    vfs.tmpfs.memory_reserved to tmpfs(5).
> 
>    PR:             275436
>    MFC after:      1 month
>    Reviewed by:    rgrimes
>    Differential Revision:  https://reviews.freebsd.org/D43011

I just got:

  make[6]: Could not create temporary file /tmp/makeDl4i9S: No space left on device

after doing a buildworld -j4 on a 4 core, 16 GiB system where /tmp is a
tmpfs, with the prior buildworld having taken me past this commit,
which I strongly suspect to be the cause. Whilst I understand the
motivation behind your commits, this is a sad regression to have; it’s
not exactly a particularly strange situation.

The system is a HiFive Unmatched, for what it's worth.

Jess