kernel: swap_pager: cannot allocate bio

This morning, I saw this in my logs:

Dec 14 04:44:56 r730-03 kernel: swap_pager: cannot allocate bio

In this post:

Looking in he logs, there wasn’t much useful:

Dec 14 04:44:56 r730-03 kernel: swap_pager: cannot allocate bio
Dec 14 04:44:56 r730-03 syslogd: last message repeated 24 times

Searching online, I found swap_pager: cannot allocate bio so I decided to limit ARC size.

I’ve done this before, and recently too.. Here is what I added to /boot/loader.conf:

# Found in logs: kernel: swap_pager: cannot allocate bio
# Memory exhaustion: re: https://lists.freebsd.org/archives/freebsd-fs/2021-November/000542.html
# top showed:
# Mem: 262M Active, 2187M Inact, 104M Laundry, 112G Wired, 10G Free
# ARC: 96G Total, 46G MFU, 47G MRU, 199M Anon, 643M Header, 3465M Other
#      86G Compressed, 205G Uncompressed, 2.39:1 Ratio
# Swap: 32G Total, 1990M Used, 30G Free, 6% Inuse
# So let's restrict ARC to:
vfs.zfs.arc_max="36000M"

I just picked the same value I was using for another host.

The values in the file can using units, such as M as shown. You can’t do that on this command:

sudo sysctl vfs.zfs.arc_max=37748736000

At the time of writing, a few hours after that change, I see this in top:

Mem: 71M Active, 892M Inact, 1957M Laundry, 54G Wired, 68G Free
ARC: 35G Total, 15G MFU, 18G MRU, 15M Anon, 273M Header, 1986M Other
     29G Compressed, 39G Uncompressed, 1.34:1 Ratio

Some may want to point out: unused RAM is wasted RAM. However, this server gets some peaks. It runs the dbclone jail which loads up database backups to make sure they load. I’m sure that suck up memory.

Metrics

Let’s look at some metrics collected during this incident. I don’t pretend to interpret this stuff, but please comment if you want to.

Memory usage

Disk IO

ARC cache misses

ARC cache hits

ARC size

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top