Categories
SysOps

How to check memory subsystem from user space

Check memory subsystem from user space.

Inspect available memory.

$ free -h
               total        used        free      shared  buff/cache   available
Mem:            31Gi        29Gi       822Mi       1.0Mi       402Mi       841Mi
Swap:          2.0Gi       487Mi       1.5Gi

Inspect memtester package.

$ apt info memtester
Package: memtester
Version: 4.5.0-1
Priority: optional
Section: universe/utils
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Laszlo Boszormenyi (GCS) <gcs@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 50.2 kB
Depends: libc6 (>= 2.10)
Homepage: http://pyropus.ca/software/memtester/
Download-Size: 16.8 kB
APT-Manual-Installed: yes
APT-Sources: http://pl.archive.ubuntu.com/ubuntu impish/universe amd64 Packages
Description: Utility for testing the memory subsystem
 This is a userspace utility for testing the memory subsystem for faults.
 In comparison to memtest86 you do not need to reboot the computer to test
 for memory faults.
 .
 Memtester can also be told to test memory starting at a particular
 physical address.

Install memtester package.

$ sudo apt install memtester

Display usage information.

$ memtester --help
memtester version 4.5.0 (64-bit)
Copyright (C) 2001-2020 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).

pagesize is 4096
pagesizemask is 0xfffffffffffff000
memtester: invalid option -- '-'

Usage: memtester [-p physaddrbase [-d device]] [B|K|M|G] [loops]

Determine the amount free memory.

$ cat /proc/meminfo  | grep MemFree
MemFree:        30800512 kB

Extract the amount free memory using machine-friendly way.

$ cat /proc/meminfo | grep Free | awk '/MemFree/ {print $2 $3}'
30790440kB

Execute the userspace utility for testing the memory subsystem three times using all available (free) memory.

$ /usr/bin/time --format "Execution time: %E" sudo memtester $(cat /proc/meminfo  | grep Free | awk '/MemFree/ {print $2 $3}') 3
memtester version 4.5.0 (64-bit)
Copyright (C) 2001-2020 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).

pagesize is 4096
pagesizemask is 0xfffffffffffff000
want 30026MB (31485300736 bytes)
got  30026MB (31485300736 bytes), trying mlock ...locked.
Loop 1/3:
  Stuck Address       : ok         
  Random Value        : ok
  Compare XOR         : ok
  Compare SUB         : ok
  Compare MUL         : ok
  Compare DIV         : ok
  Compare OR          : ok
  Compare AND         : ok
  Sequential Increment: ok
  Solid Bits          : ok         
  Block Sequential    : ok         
  Checkerboard        : ok         
  Bit Spread          : ok         
  Bit Flip            : ok         
  Walking Ones        : ok         
  Walking Zeroes      : ok         
  8-bit Writes        : ok
  16-bit Writes       : ok

Loop 2/3:
  Stuck Address       : ok         
  Random Value        : ok
  Compare XOR         : ok
  Compare SUB         : ok
  Compare MUL         : ok
  Compare DIV         : ok
  Compare OR          : ok
  Compare AND         : ok
  Sequential Increment: ok
  Solid Bits          : ok         
  Block Sequential    : ok         
  Checkerboard        : ok         
  Bit Spread          : ok         
  Bit Flip            : ok         
  Walking Ones        : ok         
  Walking Zeroes      : ok         
  8-bit Writes        : ok
  16-bit Writes       : ok

Loop 3/3:
  Stuck Address       : ok         
  Random Value        : ok
  Compare XOR         : ok
  Compare SUB         : ok
  Compare MUL         : ok
  Compare DIV         : ok
  Compare OR          : ok
  Compare AND         : ok
  Sequential Increment: ok
  Solid Bits          : ok         
  Block Sequential    : ok         
  Checkerboard        : ok         
  Bit Spread          : ok         
  Bit Flip            : ok         
  Walking Ones        : ok         
  Walking Zeroes      : ok         
  8-bit Writes        : ok
  16-bit Writes       : ok

Done.
Execution time: 0:04.98