Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Oct 2022 21:41:52 +0800
From:      Archimedes Gaviola <archimedes.gaviola@gmail.com>
To:        freebsd-current@freebsd.org
Subject:   14.0-CURRENT failed to reclaim memory error in RPi 3B build
Message-ID:  <CAJFbk7Ff8S0DeCuE88zA%2BTrXTox1XrP-o6vQ8kYO_c4t4Pj_xQ@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
--0000000000001b2d2005ec40a86c
Content-Type: text/plain; charset="UTF-8"

Hi,

I am building a kernel and world in 14.0-CURRENT
https://download.freebsd.org/ftp/snapshots/arm64/aarch64/ISO-IMAGES/14.0/FreeBSD-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.

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

Here's the set of the build commands I invoked.

root@generic# cd /usr/src ; make KERNCONF=ARM TARGET_ARCH=aarch64
buildkernel buildworld installkernel installworld distribution
DESTDIR=/home/freebsd/rpi3b

Somewhere below, the error occurred.

llvm-tblgen -gen-asm-matcher  -I /usr/src/contrib/llvm-project/llvm/include
-I /usr/src/contrib/llvm-project/llvm/lib/Target/RISCV  -d
RISCVGenAsmMatcher.inc.d -o RISCVGenAsmMatcher.inc
 /usr/src/contrib/llvm-project/llvm/lib/Target/RISCV/RISCV.td
llvm-tblgen -gen-asm-writer  -I /usr/src/contrib/llvm-project/llvm/include
-I /usr/src/contrib/llvm-project/llvm/lib/Target/RISCV  -d
RISCVGenAsmWriter.inc.d -o RISCVGenAsmWriter.inc
 /usr/src/contrib/llvm-project/llvm/lib/Target/RISCV/RISCV.td
llvm-tblgen -gen-callingconv  -I /usr/src/contrib/llvm-project/llvm/include
-I /usr/src/contrib/llvm-project/llvm/lib/Target/RISCV  -d
RISCVGenCallingConv.inc.d -o RISCVGenCallingConv.inc
 /usr/src/contrib/llvm-project/llvm/lib/Target/RISCV/RISCV.td
llvm-tblgen -gen-compress-inst-emitter  -I
/usr/src/contrib/llvm-project/llvm/include -I
/usr/src/contrib/llvm-project/llvm/lib/Target/RISCV  -d
RISCVGenCompressInstEmitter.inc.d -o RISCVGenCompressInstEmitter.inc
 /usr/src/contrib/llvm-project/llvm/lib/Target/RISCV/RISCV.td
llvm-tblgen -gen-dag-isel  -I /usr/src/contrib/llvm-project/llvm/include -I
/usr/src/contrib/llvm-project/llvm/lib/Target/RISCV  -d
RISCVGenDAGISel.inc.d -o RISCVGenDAGISel.inc
 /usr/src/contrib/llvm-project/llvm/lib/Target/RISCV/RISCV.td
*** Signal 9

Stop.
make[5]: stopped in /usr/src/lib/clang
*** Error code 1

Stop.
make[4]: stopped in /usr/src/lib
*** Error code 1

Stop.
make[3]: stopped in /usr/src
*** Error code 1

Stop.
make[2]: stopped in /usr/src
    30924.61 real     27331.99 user      2960.40 sys
*** Error code 1

Stop.
make[1]: stopped in /usr/src
*** Error code 1

Stop.
make: stopped in /usr/src

While checking the error message, it is spotted at the
/usr/src/sys/vm/vm_pageout.c in the vm_pageout_oom() routine.
...
        if (bigproc != NULL) {
                switch (shortage) {
                case VM_OOM_MEM:
                        reason = "failed to reclaim memory";
                        break;
                case VM_OOM_MEM_PF:
                        reason = "a thread waited too long to allocate a
page";
                        break;
                case VM_OOM_SWAPZ:
                        reason = "out of swap space";
                        break;
                default:
                        panic("unknown OOM reason %d", shortage);
                }
                if (vm_panic_on_oom != 0 && --vm_panic_on_oom == 0)
                        panic("%s", reason);
                PROC_LOCK(bigproc);
                killproc(bigproc, reason);
                sched_nice(bigproc, PRIO_MIN);
                _PRELE(bigproc);
                PROC_UNLOCK(bigproc);
        }
...

Any thoughts? As I don't have any idea about VM pageout.

Thanks and best regards,
Archimedes

--0000000000001b2d2005ec40a86c
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi,</div><div><br></div><div></div><div>I am building=
 a kernel and world in 14.0-CURRENT <a href=3D"https://download.freebsd.org=
/ftp/snapshots/arm64/aarch64/ISO-IMAGES/14.0/FreeBSD-14.0-CURRENT-arm64-aar=
ch64-RPI-20221027-769b884e2e2-258837.img.xz">https://download.freebsd.org/f=
tp/snapshots/arm64/aarch64/ISO-IMAGES/14.0/FreeBSD-14.0-CURRENT-arm64-aarch=
64-RPI-20221027-769b884e2e2-258837.img.xz</a> with Raspberry Pi 3B=C2=A0 (A=
RM kernel config file and in default system configurations) and compilation=
 breaks due to &quot;failed to reclaim memory&quot; error as found in the d=
mesg.<br></div><div><br></div><div>pid 91224 (llvm-tblgen), jid 0, uid 0, w=
as killed: failed to reclaim memory<br>pid 91131 (make), jid 0, uid 0, was =
killed: failed to reclaim memory</div><div><br></div><div>
<div>Here&#39;s the set of the build commands I invoked.</div><div><br></di=
v><div>root@generic#
 cd /usr/src ; make KERNCONF=3DARM TARGET_ARCH=3Daarch64 buildkernel=20
buildworld installkernel installworld distribution=20
DESTDIR=3D/home/freebsd/rpi3b</div>

</div><div><br></div><div>Somewhere below, the error occurred.<br></div><di=
v><br></div><div>llvm-tblgen -gen-asm-matcher =C2=A0-I /usr/src/contrib/llv=
m-project/llvm/include -I /usr/src/contrib/llvm-project/llvm/lib/Target/RIS=
CV =C2=A0-d RISCVGenAsmMatcher.inc.d -o RISCVGenAsmMatcher.inc =C2=A0/usr/s=
rc/contrib/llvm-project/llvm/lib/Target/RISCV/RISCV.td<br>llvm-tblgen -gen-=
asm-writer =C2=A0-I /usr/src/contrib/llvm-project/llvm/include -I /usr/src/=
contrib/llvm-project/llvm/lib/Target/RISCV =C2=A0-d RISCVGenAsmWriter.inc.d=
 -o RISCVGenAsmWriter.inc =C2=A0/usr/src/contrib/llvm-project/llvm/lib/Targ=
et/RISCV/RISCV.td<br>llvm-tblgen -gen-callingconv =C2=A0-I /usr/src/contrib=
/llvm-project/llvm/include -I /usr/src/contrib/llvm-project/llvm/lib/Target=
/RISCV =C2=A0-d RISCVGenCallingConv.inc.d -o RISCVGenCallingConv.inc =C2=A0=
/usr/src/contrib/llvm-project/llvm/lib/Target/RISCV/RISCV.td<br>llvm-tblgen=
 -gen-compress-inst-emitter =C2=A0-I /usr/src/contrib/llvm-project/llvm/inc=
lude -I /usr/src/contrib/llvm-project/llvm/lib/Target/RISCV =C2=A0-d RISCVG=
enCompressInstEmitter.inc.d -o RISCVGenCompressInstEmitter.inc =C2=A0/usr/s=
rc/contrib/llvm-project/llvm/lib/Target/RISCV/RISCV.td<br>llvm-tblgen -gen-=
dag-isel =C2=A0-I /usr/src/contrib/llvm-project/llvm/include -I /usr/src/co=
ntrib/llvm-project/llvm/lib/Target/RISCV =C2=A0-d RISCVGenDAGISel.inc.d -o =
RISCVGenDAGISel.inc =C2=A0/usr/src/contrib/llvm-project/llvm/lib/Target/RIS=
CV/RISCV.td<br>*** Signal 9<br><br>Stop.<br>make[5]: stopped in /usr/src/li=
b/clang<br>*** Error code 1<br><br>Stop.<br>make[4]: stopped in /usr/src/li=
b<br>*** Error code 1<br><br>Stop.<br>make[3]: stopped in /usr/src<br>*** E=
rror code 1<br><br>Stop.<br>make[2]: stopped in /usr/src<br>=C2=A0 =C2=A0 3=
0924.61 real =C2=A0 =C2=A0 27331.99 user =C2=A0 =C2=A0 =C2=A02960.40 sys<br=
>*** Error code 1<br><br>Stop.<br>make[1]: stopped in /usr/src<br>*** Error=
 code 1<br><br>Stop.<br>make: stopped in /usr/src</div><div><br></div><div>=
While checking the error message, it is spotted at the /usr/src/sys/vm/vm_p=
ageout.c in the vm_pageout_oom() routine.</div><div>...</div><div>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 if (bigproc !=3D NULL) {<br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 switch (shortage) {<br>=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 case VM_OOM_MEM:<br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 reason =
=3D &quot;failed to reclaim memory&quot;;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 case VM_OOM_MEM_PF:<br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 reason =3D &quot;a thread waited too long to allocate a page&quot;;<=
br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 break;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 case VM_OOM_SWAPZ:<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 reason =3D &quot;out of swap space&q=
uot;;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 break;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 default:<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 panic(&quot;unknown OOM reason %d&quot;, sh=
ortage);<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (vm_panic_on_oom=
 !=3D 0 &amp;&amp; --vm_panic_on_oom =3D=3D 0)<br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 panic(&quot;%s&=
quot;, reason);<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
PROC_LOCK(bigproc);<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 killproc(bigproc, reason);<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 sched_nice(bigproc, PRIO_MIN);<br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 _PRELE(bigproc);<br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PROC_UNLOCK(bigproc);<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 }</div><div>...<br></div><div></div><div><br></div><div></div=
><div>Any thoughts? As I don&#39;t have any idea about VM pageout.<br></div=
><div><br></div><div>Thanks and best regards,</div><div>Archimedes<br></div=
><div><br></div><div><br></div><div><br></div><div>=C2=A0<br></div></div>

--0000000000001b2d2005ec40a86c--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJFbk7Ff8S0DeCuE88zA%2BTrXTox1XrP-o6vQ8kYO_c4t4Pj_xQ>