Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Dec 2021 15:39:03 +0100
From:      Kristof Provost <kp@FreeBSD.org>
To:        freebsd-arm <freebsd-arm@freebsd.org>
Cc:        freebsd-questions@freebsd.org, freebsd-pf@freebsd.org
Subject:   Re: pf cannot allocate memory after a time
Message-ID:  <1CEFA3DA-2D46-45B3-ADE6-881A94A4D2E2@FreeBSD.org>
In-Reply-To: <YbTOficBUC8vhklu@ceres.zyxst.net>
References:  <YbTOficBUC8vhklu@ceres.zyxst.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--=_MailMate_44FD825A-A4A3-4FF5-A5A9-8E209A467CEF_=
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

On 11 Dec 2021, at 17:14, tech-lists wrote:
> context: main-n251261-25d0ccbe101 on arm64.aarch64 (raspberry 
> pi4b/8GB)
…
> pfctl: Cannot allocate memory.
>
<long story snipped>

See also https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260406

Tl;dr: pfctl fails to add addresses to a table because an uma_zalloc() 
call fails).

vmstat -z output:

	ITEM                   SIZE  LIMIT     USED     FREE      REQ     
FAILSLEEP XDOMAIN
	pf table entries:       160, 400000,   15196,    1604,   36039,   9,   
0,   0

We can clearly see the memory allocation failure there, but no obvious 
reason why.
It appears that there’s plenty of free memory, and we’re also 
clearly far away from the configured limit. Nevertheless the 
uma_zalloc() call returns NULL.

I’ve tried to dtrace that, but ran into impossible results from dtrace 
(the uma_zalloc_args:return probe did not fire, but the 
pfr_create_kentry:return did. pfr_create_kentry() unconditionally calls 
uma_zalloc_args(), so that shouldn’t be possible).

Right now the suspicion is that there’s something strange going on 
with the arm64 allocator (because it’s not been seen on amd64 so far), 
but I’m generally uncertain of everything, other than it’s not 
actually pf’s fault that it’s not getting memory.

Best regards,
Kristof
--=_MailMate_44FD825A-A4A3-4FF5-A5A9-8E209A467CEF_=
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html>
<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/xhtml; charset=3Dutf-8"=
>
</head>
<body><div style=3D"font-family: sans-serif;"><div class=3D"markdown" sty=
le=3D"white-space: normal;">
<p dir=3D"auto">On 11 Dec 2021, at 17:14, tech-lists wrote:</p>
</div><div class=3D"plaintext" style=3D"white-space: normal;"><blockquote=
 style=3D"margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #136=
BCE; color: #136BCE;"><p dir=3D"auto">context: main-n251261-25d0ccbe101 o=
n arm64.aarch64 (raspberry pi4b/8GB)</p>
</blockquote></div>
<div class=3D"markdown" style=3D"white-space: normal;">
<p dir=3D"auto">=E2=80=A6</p>
</div><div class=3D"plaintext" style=3D"white-space: normal;"><blockquote=
 style=3D"margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #136=
BCE; color: #136BCE;"><p dir=3D"auto">pfctl: Cannot allocate memory.</p>
<br></blockquote></div>
<div class=3D"markdown" style=3D"white-space: normal;">
<p dir=3D"auto">&lt;long story snipped&gt;</p>
<p dir=3D"auto">See also <a href=3D"https://bugs.freebsd.org/bugzilla/sho=
w_bug.cgi?id=3D260406">https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D=
260406</a></p>
<p dir=3D"auto">Tl;dr: pfctl fails to add addresses to a table because an=
 uma_zalloc() call fails).</p>
<p dir=3D"auto">vmstat -z output:</p>
<pre style=3D"margin-left: 15px; margin-right: 15px; padding: 5px; border=
: thin solid gray; overflow-x: auto; max-width: 90vw; background-color: #=
E4E4E4;"><code>ITEM                   SIZE  LIMIT     USED     FREE      =
REQ     FAILSLEEP XDOMAIN
pf table entries:       160, 400000,   15196,    1604,   36039,   9,   0,=
   0
</code></pre>
<p dir=3D"auto">We can clearly see the memory allocation failure there, b=
ut no obvious reason why.<br>
It appears that there=E2=80=99s plenty of free memory, and we=E2=80=99re =
also clearly far away from the configured limit. Nevertheless the uma_zal=
loc() call returns NULL.</p>
<p dir=3D"auto">I=E2=80=99ve tried to dtrace that, but ran into impossibl=
e results from dtrace (the uma_zalloc_args:return probe did not fire, but=
 the pfr_create_kentry:return did. pfr_create_kentry() unconditionally ca=
lls uma_zalloc_args(), so that shouldn=E2=80=99t be possible).</p>
<p dir=3D"auto">Right now the suspicion is that there=E2=80=99s something=
 strange going on with the arm64 allocator (because it=E2=80=99s not been=
 seen on amd64 so far), but I=E2=80=99m generally uncertain of everything=
, other than it=E2=80=99s not actually pf=E2=80=99s fault that it=E2=80=99=
s not getting memory.</p>
<p dir=3D"auto">Best regards,<br>
Kristof</p>

</div></div></body>

</html>

--=_MailMate_44FD825A-A4A3-4FF5-A5A9-8E209A467CEF_=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1CEFA3DA-2D46-45B3-ADE6-881A94A4D2E2>