Skip to content

Instantly share code, notes, and snippets.

@linuskendall
Last active November 28, 2023 11:19
Show Gist options
  • Save linuskendall/989ba64b0298df0f9cfb5aa057b3e4ff to your computer and use it in GitHub Desktop.
Save linuskendall/989ba64b0298df0f9cfb5aa057b3e4ff to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
XDG_RUNTIME_DIR="/run/user/$(id -u solana)"
set -o errexit
set -o nounset
set -o pipefail
PID=$(pidof solana-validator)
if [[ -z "${PID}" ]]; then
echo "Solana not running it seems. Could not find solana-validator pid."
exit 1
fi
for thread_proc in /proc/${PID}/task/*
do
if [ -d "${thread_proc}" ]; then
TID=$(basename "$thread_proc")
THREAD_NAME=$(<"${thread_proc}/comm")
echo "${THREAD_NAME} ${TID}"
if [[ "${THREAD_NAME}" == "solana-poh-serv" ]]; then
# realtime priority:
# chrt -r -p 20 ${TID}
# set core
# taskset -pc 2 ${TID}
renice -n -10 -p "${TID}"
else
renice -n -5 -p "${TID}"
fi
fi
done
renice -n -5 -p "${PID}"
@McSim85
Copy link

McSim85 commented Nov 28, 2023

I think, this line
if [[ "${THREAD_NAME}" == "solana-poh-serv" ]]; then
can be modified to
if [[ "${THREAD_NAME,,}" == *"poh"* ]]; then
Because. the latest thread names are

 ps -A  -L -o pid,tid,ni,comm | grep -i poh
31780 31874   0 solPohTimingRpt
31780 32764   0 solPohTickProd

I think, we can renice only solPohTickProd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment