Adjust fullnode/drone oom_score_adj to goad the kernel into killing it first

This commit is contained in:
Michael Vines 2018-08-07 10:23:38 -07:00
parent 16772d3d51
commit 0ee935dd72
4 changed files with 18 additions and 0 deletions

View File

@ -173,6 +173,21 @@ tune_networking() {
fi
}
oom_score_adj() {
declare pid=$1
declare score=$2
if [[ $(uname) != Linux ]]; then
return
fi
(
echo "$score" > "/proc/$pid/oom_score_adj"
if [[ $score != $(cat "/proc/$pid/oom_score_adj") ]]; then
echo "Failed to set oom_score_adj for pid $pid"
fi
)
}
SOLANA_CONFIG_DIR=${SNAP_DATA:-$PWD}/config
SOLANA_CONFIG_PRIVATE_DIR=${SNAP_DATA:-$PWD}/config-private
SOLANA_CONFIG_VALIDATOR_DIR=${SNAP_DATA:-$PWD}/config-validator

View File

@ -42,4 +42,5 @@ $solana_drone \
-l "$SOLANA_CONFIG_DIR"/leader.json -k "$SOLANA_CONFIG_PRIVATE_DIR"/mint.json \
> >($drone_logger) 2>&1 &
pid=$!
oom_score_adj "$pid" 1000
wait "$pid"

View File

@ -31,4 +31,5 @@ $program \
--ledger "$SOLANA_CONFIG_DIR"/ledger \
> >($leader_logger) 2>&1 &
pid=$!
oom_score_adj "$pid" 1000
wait "$pid"

View File

@ -108,4 +108,5 @@ $program \
--ledger "$SOLANA_LEADER_CONFIG_DIR"/ledger \
> >($validator_logger) 2>&1 &
pid=$!
oom_score_adj "$pid" 1000
wait "$pid"