Skip to content

Commit

Permalink
Add check_hw_slab_unreclaimable check
Browse files Browse the repository at this point in the history
  • Loading branch information
treydock committed Nov 28, 2018
1 parent fa5d035 commit 1ef56bb
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions scripts/lbnl_hw.nhc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ HW_RAM_TOTAL=0
HW_RAM_FREE=0
HW_SWAP_TOTAL=0
HW_SWAP_FREE=0
HW_SLAB_UNRECLAIMABLE=0
HW_IB_STATE=( )
HW_IB_PHYS_STATE=()
HW_IB_RATE=( )
Expand Down Expand Up @@ -81,6 +82,8 @@ function nhc_hw_gather_data() {
HW_SWAP_TOTAL=${FIELD[1]}
elif [[ "${FIELD[0]}" = "SwapFree:" ]]; then
HW_SWAP_FREE=${FIELD[1]}
elif [[ "${FIELD[0]}" = "SUnreclaim:" ]]; then
HW_SLAB_UNRECLAIMABLE=${FIELD[1]}
fi
done < /proc/meminfo
else
Expand Down Expand Up @@ -328,6 +331,23 @@ function check_hw_mem_free() {
return 0
}

# Check amount of Slab unreclaimable against maximum ($1).
function check_hw_slab_unreclaimable() {
local MAXUNRECLAIMABLE=$1

if [[ $HW_RAM_TOTAL -eq 0 ]]; then
nhc_hw_gather_data
fi

nhc_common_parse_size "$MAXUNRECLAIMABLE" MAXUNRECLAIMABLE

if [[ $HW_SLAB_UNRECLAIMABLE -gt $MAXUNRECLAIMABLE ]]; then
die 1 "$FUNCNAME: Slab unreclaimable is too large ($HW_SLAB_UNRECLAIMABLE kB > $MAXUNRECLAIMABLE kB)."
return 1
fi
return 0
}

# Check if IB state, phys_state, and rate ($1) all match.
function check_hw_ib() {
local STATE="ACTIVE"
Expand Down

0 comments on commit 1ef56bb

Please sign in to comment.