Browse Source

Edit configure_mlx.sh for calculate dinamically the value for iogpu.wired_limit_mb and iogpu.wired_lwm_mb. The script limit wired_limit_mb to 80% and wired_lwm_mb to 70%, but this threshold are variables.

Giuseppe Gambino 7 months ago
parent
commit
84ce076860
1 changed files with 4 additions and 9 deletions
  1. 4 9
      configure_mlx.sh

+ 4 - 9
configure_mlx.sh

@@ -3,15 +3,10 @@
 # Get the total memory in MB
 TOTAL_MEM_MB=$(($(sysctl -n hw.memsize) / 1024 / 1024))
 
-# Calculate the maximum limit as 80% of the total memory
+# Set WIRED_LIMIT_MB to 80%
 WIRED_LIMIT_MB=$(($TOTAL_MEM_MB * 80 / 100))
-
-# Calculate the lower bound as 60%-80% of the maximum limit
-WIRED_LWM_MIN=$(($WIRED_LIMIT_MB * 60 / 100))
-WIRED_LWM_MAX=$(($WIRED_LIMIT_MB * 80 / 100))
-
-# Choose a mid-range value for wired_lwm_mb
-WIRED_LWM_MB=$(($WIRED_LWM_MIN + ($WIRED_LWM_MAX - $WIRED_LWM_MIN) / 2))
+# Set  WIRED_LWM_MB to 70%
+WIRED_LWM_MB=$(($TOTAL_MEM_MB * 70 / 100))
 
 # Display the calculated values
 echo "Total memory: $TOTAL_MEM_MB MB"
@@ -20,4 +15,4 @@ echo "Lower bound (iogpu.wired_lwm_mb): $WIRED_LWM_MB MB"
 
 # Apply the values with sysctl
 sudo sysctl -w iogpu.wired_limit_mb=$WIRED_LIMIT_MB
-sudo sysctl -w iogpu.wired_lwm_mb=$WIRED_LWM_MB
+sudo sysctl -w iogpu.wired_lwm_mb=$WIRED_LWM_MB