icepick/tools/setup_resctrl.sh
2026-01-17 23:34:52 +00:00

38 lines
932 B
Bash
Executable file

#!/bin/bash
set -e
RESCTRL_MOUNT="/sys/fs/resctrl"
if [ "$(id -u)" -ne 0 ]; then
echo "error: this script must be run as root"
exit 1
fi
if ! grep -q "resctrl" /proc/filesystems 2>/dev/null; then
echo "error: resctrl filesystem not supported by this kernel"
echo "ensure config_x86_cpu_resctrl is enabled"
exit 1
fi
if mount | grep -q "resctrl"; then
echo "resctrl already mounted at:"
mount | grep resctrl
exit 0
fi
mkdir -p "$RESCTRL_MOUNT"
echo "mounting resctrl filesystem..."
mount -t resctrl resctrl "$RESCTRL_MOUNT"
echo "resctrl mounted successfully at $RESCTRL_MOUNT"
echo
echo "l3 cat info:"
if [ -d "$RESCTRL_MOUNT/info/L3" ]; then
echo " cbm mask: $(cat $RESCTRL_MOUNT/info/L3/cbm_mask)"
echo " min cbm: $(cat $RESCTRL_MOUNT/info/L3/min_cbm_bits)"
echo " num clos: $(cat $RESCTRL_MOUNT/info/L3/num_closids)"
else
echo " l3 cat info not available"
fi