Skip to content

Commit fa4a134

Browse files
committed
Add check_hw_slab_unreclaimable check
1 parent fa5d035 commit fa4a134

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,17 @@ _**Example** (require at least 1 GB free)_: `check_hw_swap_free 1048576`
898898
<br />
899899
900900
901+
##### check_hw_slab_unreclaimable
902+
`check_hw_slab_unreclaimable max_kb`
903+
904+
`check_hw_slab_unreclaimable` compares the amount of slab unreclaimable memory to the maximum provided (in kB). If the slab unreclaimable is greater than _max_kb_ kilobytes, the check fails.
905+
906+
_**Example** (require less than 5 GB unreclaimable)_: `check_hw_slab_unreclaimable 5242880`
907+
908+
909+
<br />
910+
911+
901912
##### check_moab_sched
902913
`check_moab_sched [-t timeout] [-a alert_match] [-m [!]mstr] [-v version_match]`
903914

scripts/lbnl_hw.nhc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ HW_RAM_TOTAL=0
1111
HW_RAM_FREE=0
1212
HW_SWAP_TOTAL=0
1313
HW_SWAP_FREE=0
14+
HW_SLAB_UNRECLAIMABLE=0
1415
HW_IB_STATE=( )
1516
HW_IB_PHYS_STATE=()
1617
HW_IB_RATE=( )
@@ -81,6 +82,8 @@ function nhc_hw_gather_data() {
8182
HW_SWAP_TOTAL=${FIELD[1]}
8283
elif [[ "${FIELD[0]}" = "SwapFree:" ]]; then
8384
HW_SWAP_FREE=${FIELD[1]}
85+
elif [[ "${FIELD[0]}" = "SUnreclaim:" ]]; then
86+
HW_SLAB_UNRECLAIMABLE=${FIELD[1]}
8487
fi
8588
done < /proc/meminfo
8689
else
@@ -328,6 +331,23 @@ function check_hw_mem_free() {
328331
return 0
329332
}
330333

334+
# Check amount of Slab unreclaimable against maximum ($1).
335+
function check_hw_slab_unreclaimable() {
336+
local MAXUNRECLAIMABLE=$1
337+
338+
if [[ $HW_RAM_TOTAL -eq 0 ]]; then
339+
nhc_hw_gather_data
340+
fi
341+
342+
nhc_common_parse_size "$MAXUNRECLAIMABLE" MAXUNRECLAIMABLE
343+
344+
if [[ $HW_SLAB_UNRECLAIMABLE -gt $MAXUNRECLAIMABLE ]]; then
345+
die 1 "$FUNCNAME: Slab unreclaimable is too large $HW_SLAB_UNRECLAIMABLE kB > $MAXUNRECLAIMABLE kB."
346+
return 1
347+
fi
348+
return 0
349+
}
350+
331351
# Check if IB state, phys_state, and rate ($1) all match.
332352
function check_hw_ib() {
333353
local STATE="ACTIVE"

0 commit comments

Comments
 (0)