From: Alexander Bluhm Subject: Re: Count m_pool_alloc() failures in netstat -m To: Theo de Raadt , Stefan Fritsch , tech@openbsd.org Date: Tue, 10 Jun 2025 19:24:25 +0200 On Tue, Jun 10, 2025 at 04:24:13PM +0200, Claudio Jeker wrote: > On Tue, Jun 10, 2025 at 08:02:02AM -0600, Theo de Raadt wrote: > > Stefan Fritsch wrote: > > > > > Diff below. Does one need to do something special when changing the sysctl > > > structs? Comments, opinions? > > > > It will be a subtle and small ABI breakage between the kernel and the > > netstat binary, but I don't see anything else actually looking at the > > fields in the structure. It is extremely unlikely anything in ports > > looks at any fields, and will notice their positions have changed. > > I think best would be to just replace the fields with pads. There is some > rather bad code in golang and rust. We may be lucky and nobody pulls those > sysctl structs out yet but e.g. node_exporter is very sloppy since > everyone thinks the ABI will never change. The ABI has changed a few releases ago when I added the defrag and prepend counters at the end of the struct. So software that epxects the old struct from 2002 should be broken anyway. These fields look very BSD specific to me. I would just remove them and don't bother with padding. Incrementing the fail counter is obvious. This chunk is OK bluhm. Our stack has not use mbufs drain for a long time. So removing the counter seems reasonable unless someone wants this feature back. The wait counter would be interesting. Accounting whenever m_get(M_WAIT) actually has to sleep, could help to indentify performance bottlenecks. But only pool knows about sleeps. Problem is to propagate this information from pl_sleep() to mbuf layer with a clean API. Or should we add a pool counter for that? bluhm