Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Sep 2025 11:46:00 +0200
From:      Kristof Provost <kp@FreeBSD.org>
To:        Gleb Smirnoff <glebius@freebsd.org>
Cc:        src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: ddd39152743a - main - pf: Introduce M_PF type for pf(4) related memory allocations.
Message-ID:  <85886BF4-570F-4F4A-8FE4-3B064C8E8D20@FreeBSD.org>
In-Reply-To: <aLfGj76MIfsLA9Yu@cell.glebi.us>
References:  <202509022110.582LAr4f036441@gitrepo.freebsd.org> <aLfGj76MIfsLA9Yu@cell.glebi.us>

next in thread | previous in thread | raw e-mail | index | archive | help
On 3 Sep 2025, at 6:39, Gleb Smirnoff wrote:
> On Tue, Sep 02, 2025 at 09:10:53PM +0000, Kristof Provost wrote:
> K> The branch main has been updated by kp:
> K>
> K> URL: https://cgit.FreeBSD.org/src/commit/?id=3Dddd39152743abc3cff05e=
7475c0ce48aa303956a
> K>
> K> commit ddd39152743abc3cff05e7475c0ce48aa303956a
> K> Author:     Kristof Provost <kp@FreeBSD.org>
> K> AuthorDate: 2025-08-18 12:19:40 +0000
> K> Commit:     Kristof Provost <kp@FreeBSD.org>
> K> CommitDate: 2025-09-02 21:10:20 +0000
> K>
> K>     pf: Introduce M_PF type for pf(4) related memory allocations.
> K>
> K>     Currently used M_TEMP and M_IFADDR types are unreasonable for th=
at purpose.
> K>     This dedicated statistics simplify the future pf(4) unlocking wo=
rk by decreasing
> K>     search area of possible memory leaks.
>
> IMHO, going away from M_TEMP to something else for allocations that las=
t for
> duration of a syscall is a regression rather than an improvement.
>
I can see the argument, however, I think there are sufficient reasons for=
 it anyway.

The first is that not all of these allocations are correctly M_TEMP anywa=
y. It was used to allocate struct pf_krule_global for example (as well as=
 anchors).
The second is that this indeed revealed memory leaks (since fixed) that w=
e wouldn=E2=80=99t have been aware of otherwise (and that does also apply=
 to allocations that are temporary). See 44cc3b2731914f94851c0e468a5fa07c=
5f6ca006 for that one.

And finally, the usual argument of diff reduction with OpenBSD. Although =
to be fair, it=E2=80=99s not exactly hard to change the malloc type when =
porting patches, but it is yet another opportunity to mess something up.

Best regards,
Kristof



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?85886BF4-570F-4F4A-8FE4-3B064C8E8D20>