[Bug 275594] High CPU usage by arc_prune; analysis and fix

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 07 Mar 2024 18:54:24 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275594

--- Comment #81 from Anton Saietskii <vsasjason@gmail.com> ---
(In reply to Anton Saietskii from comment #73)

After applying patches onto releng/13.3 (without any sysctl tuning) works like
a charm so far! I can't even see neither arc_prune nor vnlru in top now, only a
bit a pagedaemon (which eventually may eat up to 100%, but not for long and
without stalling system), snip follows:

last pid: 77896;  load averages:  2.34,  4.42,  4.76; battery: 100%            
                                                                          up
0+02:36:12  19:29:16
1089 threads:  10 running, 1049 sleeping, 30 waiting
CPU 0:  4.7% user,  0.0% nice, 14.1% system,  0.0% interrupt, 81.2% idle
CPU 1:  6.3% user,  0.0% nice, 20.9% system,  0.0% interrupt, 72.8% idle
CPU 2: 19.9% user,  0.0% nice, 17.3% system,  0.0% interrupt, 62.8% idle
CPU 3: 12.8% user,  0.0% nice,  9.7% system,  0.0% interrupt, 77.4% idle
CPU 4: 23.6% user,  0.0% nice, 14.7% system,  0.0% interrupt, 61.8% idle
CPU 5: 18.8% user,  0.0% nice, 11.5% system,  0.0% interrupt, 69.6% idle
CPU 6: 13.1% user,  0.0% nice, 12.6% system,  1.0% interrupt, 73.3% idle
CPU 7: 10.6% user,  0.0% nice, 18.0% system,  0.5% interrupt, 70.9% idle
Mem: 101M Active, 998M Inact, 1600M Laundry, 58G Wired, 524K Buf, 1651M Free
ARC: 55G Total, 29G MFU, 25G MRU, 83M Anon, 225M Header, 617M Other
     52G Compressed, 53G Uncompressed, 1.02:1 Ratio
Swap: 8192M Total, 8192M Free

  PID   JID USERNAME    PRI NICE   SIZE    RES STATE    C   TIME    WCPU
COMMAND
77368     5 pbuild      100    0   106M    73M CPU6     6   0:25  99.87%
/usr/bin/tar -xf /portdistfiles//firefox-123.0.1.source.tar.xz --no-same-owner
--no-same-permissions (bs
  472     0 root         52  -20   375M   205M vmidle   2  87:38  59.19% bhyve:
wifibox (bhyve){vcpu 0}
 1677     0 transmissi   52    0   488M   286M kqread   1  67:36  51.56%
/usr/local/bin/transmission-daemon -g /usr/local/etc/transmission/ -e
/var/log/transmission.log -x /var/
  472     0 root         20  -20   375M   205M uwait    5   7:44   5.01% bhyve:
wifibox (bhyve){e82545-5:0 tx}
    7     0 root        -16    -     0B    48K psleep   6   2:16   4.77%
[pagedaemon{dom0}]
  472     0 root         20  -20   375M   205M kqread   4   6:48   4.15% bhyve:
wifibox (bhyve){mevent}
   12     0 root        -88    -     0B   480K WAIT     6   1:40   0.68%
[intr{irq128: ahci0}]
    0     0 root        -16    -     0B    11M -        4   0:02   0.54%
[kernel{z_rd_int_1_2}]
    0     0 root        -16    -     0B    11M -        7   0:15   0.47%
[kernel{z_rd_int_0_1}]
   69     0 root         20    -     0B    16K geli:w   7   0:32   0.40%
[g_eli[7] diskid/DIS]

And a shorter snip during actual Fx build:
Mem: 5844M Active, 1941M Inact, 2457M Laundry, 50G Wired, 524K Buf, 1666M Free
ARC: 47G Total, 27G MFU, 19G MRU, 67M Anon, 192M Header, 581M Other
     44G Compressed, 45G Uncompressed, 1.02:1 Ratio
Swap: 8192M Total, 62M Used, 8130M Free

  PID   JID USERNAME    PRI NICE   SIZE    RES STATE    C   TIME    WCPU
COMMAND
10614     5 pbuild      103    0  3632M  2803M CPU3     3   0:28  99.94%
/usr/local/bin/rustc --crate-name style --edition=2018
servo/components/style/lib.rs --error-format=json
  472     0 root         52  -20   375M   205M vmidle   5  98:39  54.51% bhyve:
wifibox (bhyve){vcpu 0}
 1677     0 transmissi   48    0   488M   283M kqread   2  74:52  30.67%
/usr/local/bin/transmission-daemon -g /usr/local/etc/transmission/ -e
/var/log/transmission.log -x /var/
  472     0 root         20  -20   375M   205M RUN      0   8:42   5.37% bhyve:
wifibox (bhyve){e82545-5:0 tx}
  472     0 root         20  -20   375M   205M kqread   6   7:35   4.02% bhyve:
wifibox (bhyve){mevent}

A bit of swap being used, but again: works like a charm, no stalls at all.

Seigo, thanks a lot for you effort, I do greatly appreciate it!

-- 
You are receiving this mail because:
You are the assignee for the bug.