On 22/10/23(Sun) 20:29, Miod Vallat wrote:
> > On 21/10/23(Sat) 14:28, Miod Vallat wrote:
> > > > Stuart, Miod, I wonder if this also help for the off-by-one issue you
> > > > are seeing.  It might not.
> > > 
> > > It makes the aforementioned issue disappear on the affected machine.
> > 
> > Thanks at lot for testing!
> 
> Spoke too soon. I have just hit
> 
> panic: kernel diagnostic assertion "uvmexp.swpgonly > 0" failed: file 
> "/usr/src/sys/uvm/uvm_anon.c", line 121
> Stopped at      db_enter+0x8:   add     #0x4, r14
>     TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
> *235984  11904      0     0x14000      0x200    0  reaper
> db_enter() at db_enter+0x8
> panic() at panic+0x74
> __assert() at __assert+0x1c
> uvm_anfree_list() at uvm_anfree_list+0x156
> amap_wipeout() at amap_wipeout+0xe6
> uvm_unmap_detach() at uvm_unmap_detach+0x42
> uvm_map_teardown() at uvm_map_teardown+0x104
> uvmspace_free() at uvmspace_free+0x2a
> reaper() at reaper+0x86
> ddb> show uvmexp
> Current UVM status:
>   pagesize=4096 (0x1000), pagemask=0xfff, pageshift=12
>   14875 VM pages: 376 active, 2076 inactive, 1 wired, 7418 free (924
> zero)
>   min  10% (25) anon, 10% (25) vnode, 5% (12) vtext
>   freemin=495, free-target=660, inactive-target=2809, wired-max=4958
>   faults=73331603, traps=39755714, intrs=33863551, ctxswitch=11641480
> fpuswitch
> =0
>   softint=15742561, syscalls=39755712, kmapent=11
>   fault counts:
>     noram=1, noanon=0, noamap=0, pgwait=1629, pgrele=0
>     ok relocks(total)=1523991(1524022), anget(retries)=23905247(950233),
> amapco
> py=9049749
>     neighbor anon/obj pg=12025732/40041442,
> gets(lock/unlock)=12859247/574102
>     cases: anon=20680175, anoncow=3225049, obj=11467884, prcopy=1391019,
> przero
> =36545783
>   daemon and swap counts:
>     woke=6868, revs=6246, scans=3525644, obscans=511526, anscans=2930634
>     busy=0, freed=1973275, reactivate=83484, deactivate=3941988
>     pageouts=94506, pending=94506, nswget=949421
>     nswapdev=1
>     swpages=4194415, swpginuse=621, swpgonly=0 paging=0
>   kernel pointers:
>     objs(kern)=0x8c3ca94c

I wonder if the diff below makes a difference.  It's hard to debug and it
might be worth adding a counter for bad swap slots.

Index: uvm/uvm_anon.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_anon.c,v
retrieving revision 1.56
diff -u -p -r1.56 uvm_anon.c
--- uvm/uvm_anon.c      2 Sep 2023 08:24:40 -0000       1.56
+++ uvm/uvm_anon.c      22 Oct 2023 21:27:42 -0000
@@ -116,7 +116,7 @@ uvm_anfree_list(struct vm_anon *anon, st
                        uvm_unlock_pageq();     /* free the daemon */
                }
        } else {
-               if (anon->an_swslot != 0) {
+               if (anon->an_swslot != 0 && anon->an_swslot != SWSLOT_BAD) {
                        /* This page is no longer only in swap. */
                        KASSERT(uvmexp.swpgonly > 0);
                        atomic_dec_int(&uvmexp.swpgonly);

Reply via email to