Re: Can not build kernel on 1GB VM *Solved*

From: Michael Wayne <freebsd07_at_wayne47.com>
Date: Mon, 09 May 2022 16:45:28 UTC
On Wed, Apr 20, 2022 at 11:12:29AM +0200, T??l Coosemans wrote:
> On Mon, 18 Apr 2022 13:33:33 -0400 Michael Wayne <freebsd07@wayne47.com>
> wrote:
> > On Fri, Apr 15, 2022 at 01:49:53PM -0400, Michael Wayne wrote:
> >> I have a VM with 1GB RAM running FreeBSD 12.1-RELEASE-p3
> >> 
> >> I'm trying to upgrade the machine to 12.3 and having swap failures.  
> > 
> > I tried a number of things, all of which failed.
> > 
> > Since the offending line is:
> > 
> >>    ctfmerge -L VERSION -g -o kernel.full ...  
> > 
> > I went digging through makefiles and found:
> >    MK_CTF=no
> > 
> > Adding this to the command line permitted the build to complete and
> > the machine is now running on the new kernel. Hopefully this helps
> > others. I'm still not sure why the kernel refused to use swap but 
> > this is a very easy to duplicate issue.
> 
> How many CPU cores does the VM have?

I believe only 1:

   CPU: Intel Core Processor (Broadwell, no TSX, IBRS) (2394.51-MHz K8-class CPU)
     Origin="GenuineIntel"  Id=0x306d2  Family=0x6  Model=0x3d  Stepping=2
     Features=0x783fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE,SSE2>
     Features2=0xfffa3203<SSE3,PCLMULQDQ,SSSE3,FMA,CX16,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND,HV>
     AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
     AMD Features2=0x21<LAHF,ABM>
     Structured Extended Features=0x7a9<FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID>
     Structured Extended Features3=0x84000000<IBPB,SSBD>
     XSAVE Features=0x1<XSAVEOPT>
   Hypervisor: Origin = "KVMKVMKVM"
   real memory  = 1073741824 (1024 MB)
   avail memory = 1001181184 (954 MB)

> Can you still reproduce it now that you run 12.3?

Yes. It persists.

> If so, can you try the attached patch?  It prevents background



Building now.



> laundering when nfreed == 0, restoring some behaviour from before
> https://cgit.freebsd.org/src/commit/?id=c098768e4dad and
> https://cgit.freebsd.org/src/commit/?id=60684862588f.

> diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
> index 36d5f3275800..df827af3075f 100644
> --- a/sys/vm/vm_pageout.c
> +++ b/sys/vm/vm_pageout.c
> @@ -1069,7 +1069,7 @@ vm_pageout_laundry_worker(void *arg)
>  		nclean = vmd->vmd_free_count +
>  		    vmd->vmd_pagequeues[PQ_INACTIVE].pq_cnt;
>  		ndirty = vmd->vmd_pagequeues[PQ_LAUNDRY].pq_cnt;
> -		if (target == 0 && ndirty * isqrt(howmany(nfreed + 1,
> +		if (target == 0 && ndirty * isqrt(howmany(nfreed,
>  		    vmd->vmd_free_target - vmd->vmd_free_min)) >= nclean) {
>  			target = vmd->vmd_background_launder_target;
>  		}