Re: bcm283x_dwcotg0: usbpf: Out of memory

Mark Millard <[email protected]> Thu, 16 Apr 2026 23:16:54 -0700
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <[email protected]>
On 4/16/26 20:50, Carl Johnson wrote:
> bob prohaska <[email protected]> writes:
> 
>> On Thu, Apr 16, 2026 at 10:45:06AM -0700, Mark Millard wrote:
>>> On 4/16/26 08:15, void wrote:
>>>> just to update, I had to quickly add more swap,
>>>> otherwise buildworld crashes. It seems more swap is needed
>>>> the more N in make -jN buildworld is used.
>>>>
>>>> For the time being I quickly made three 3gb swap partitions
>>>> on a usb2 stick and removed the default growfs swapfile
>>>> and now make -j3 buildworld is proceeding, if slowly.
>>>>
>>>> I've not tested yet whether writing to the stick is
>>>> faster than writing to nfs. if not, there's always the option
>>>> of mounting swap over nfs.
>>>
>>> You are likely getting console messages like (lines wrapped differently
>>> here):
>>>
>>> warning: total configured swap (??? pages) exceeds maximum recommended
>>> amount (??? pages).
>>> warning: increase kern.maxswzone or reduce amount of swap.
>>>
>>> Indicating potential mis-tunning that can result in deadlocks being more
>>> likely from kernel memory management, if I understand right. Also, as I
>>> understand, actually increasing kern.maxswzone trades off the amounts of
>>> other types of kernel(?) memory available. (Not that I know the detailed
>>> tradeoffs.)
>>>
>>> A RPi2B has 1 GiByte of RAM. As I remember, armv7 (so: 32-bit) starts
>>> putting out that notice-pair at somewhat under 2 GiBytes of swap space
>>> (somewhere between 1.7 GiBytes and 2.0 GiBytes?). (64-bit has a much
>>> larger ratio before getting such notices, as I remember.)
>>>
>>> If Bob is still using large swap spaces, there is some possibility that
>>> such has contributed to running out of memory, not that I know how to
>>> validate such happened.
>>>
>>
>> It turns out a 1.8GB swap partition does not provoke the "excess 
>> swap" warning and seems sufficient for a -j3 buildworld to proceed.
>> -j4 works usually, but if Clang is fully rebuilt in -j4 the machine
>> _can_ run out of swap and kill processes.  
>>
>> Using swap on microSD or USB flash led (I think) to subtle binary
>> corruption that you helped me sort out. Since then I've used only
>> mechanical hard disks for swap and have not seen any obvious repeats.
> 
> I was looking at some old notes for a Raspberry Pi 2 and I had set
> kern.maxswzone=20971520 in /boot/loader.conf with 3.5GB of swap space.

Do you know what tradeoffs were involved from the use of:
kern.maxswzone=20971520 ?

I've never figured out how to tell better from worse non-default
settings based on whatever the specific tradeoffs are versus workload needs.

> That was on a swap partition on a 64GB SD card.  I am not sure what size
> was necessary, but that was something that worked then without the swap
> space too large warning.  I haven't tried that for some time, so I can't
> offer any more help than that.  It looks like I was running FreeBSD
> 12.1-RELEASE at that time.
> 
> I hope that helps some.
> 


-- 
===
Mark Millard
marklmi at yahoo.com