Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Oct 2022 10:29:14 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Archimedes Gaviola <archimedes.gaviola@gmail.com>, freebsd-current <freebsd-current@freebsd.org>
Subject:   RE: 14.0-CURRENT failed to reclaim memory error in RPi 3B build
Message-ID:  <84376CC9-B991-4BF3-AF5F-0AA09CB28339@yahoo.com>
References:  <84376CC9-B991-4BF3-AF5F-0AA09CB28339.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Archimedes Gaviola <archimedes.gaviola_at_gmail.com>wrote on
Date: Sun, 30 Oct 2022 13:41:52 UTC :

> I am building a kernel and world in 14.0-CURRENT
> =
https://download.freebsd.org/ftp/snapshots/arm64/aarch64/ISO-IMAGES/14.0/F=
reeBSD-14.0-CURRENT-arm64-aarch64-RPI-20221027-769b884e2e2-258837.img.xz
> with Raspberry Pi 3B  (ARM kernel config file and in default system
> configurations) and compilation breaks due to "failed to reclaim =
memory"
> error as found in the dmesg.
>=20
> pid 91224 (llvm-tblgen), jid 0, uid 0, was killed: failed to reclaim =
memory
> pid 91131 (make), jid 0, uid 0, was killed: failed to reclaim memory
>=20
> Here's the set of the build commands I invoked.
>=20
> root@generic# cd /usr/src ; make KERNCONF=3DARM TARGET_ARCH=3Daarch64
> buildkernel buildworld installkernel installworld distribution
> DESTDIR=3D/home/freebsd/rpi3b
>=20
> . . .
>=20
> Any thoughts? As I don't have any idea about VM pageout.

Multiple configuration things from what I use:

I use a swap partition (not a swap file!) to give the system
someplace to put copies of inactive memory pages (paging):

# swapinfo
Device          1K-blocks     Used    Avail Capacity
/dev/gpt/Rock64swp2   3670016        0  3670016     0%

where gpart show -p lists it as (a gpt context, not MBR):

      534528     7340032  da0p2  freebsd-swap  (3.5G)

and gpart show -pl lists it as:

      534528     7340032  da0p2  Rock64swp2  (3.5G)

(Note: swap file usage is subject to deadlock conditions
avoided by use of swap partitions.)

I use a serial console & ssh session only context to avoid
having sizable competition for RAM.

I avoid using tmpfs because it competes for RAM use.

I use the likes of ( in, say, /boot/loader/conf ):

#
# Delay when persistent low free RAM leads to
# Out Of Memory killing of processes:
vm.pageout_oom_seq=3D120

This delays potential "killed: failed to reclaim memory" kills,
possibly long enough to reach a state where sufficient memory is
reclaimed.

I'll note that the status "killed: failed to reclaim memory" does
not require that swap be used much at all. Sustained low free RAM
from just one process that always stays runnable and has a
sufficiently large active set of pages can be sufficient to end up
with such kills. Having swap allows for inactive pages to get out
of the way, which can help.

I use the likes of ( in, say, /etc/ssyctl.conf ):

#
# Together this pair avoids swapping out the process kernel stacks.
# This avoids processes for interacting with the system from being
# hung-up.
vm.swap_enabled=3D0
vm.swap_idle_enabled=3D0

This allows paging to the swap space but disallows moving
kernel thread stacks to the swap space. Otherwise the
processes used to interact with the RPi3 can become
non-runnable, preventing such interactions.

I have NVMe or SSD based USB media, not microsd cards nor
spinning rust. (I use just bootcode.bin and timeout files
on microsd media for the RPi3B. Even the rest of the RPi*
firmware is on the USB media, as well as u-boot.bin .)

My usage of such a configuration struture for building
software (world, kernel, ports) applies to all the
systems I do such with, including ones with a lot more
resources, including a lot more RAM.

=3D=3D=3D
Mark Millard
marklmi at yahoo.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?84376CC9-B991-4BF3-AF5F-0AA09CB28339>