From 901ae716a88b7cd334ffaa606a62bc6ee3e8a878 Mon Sep 17 00:00:00 2001 From: Wes Morgan Date: Tue, 31 Oct 2023 23:13:28 -0500 Subject: [PATCH 1/2] blah Add support for realtime and idle time priorities with "rNN" and "iNN" values for priority. --- lib/vm-rctl | 10 +++++++++- vm.8 | 9 ++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/vm-rctl b/lib/vm-rctl index e0245d64..3c106e63 100644 --- a/lib/vm-rctl +++ b/lib/vm-rctl @@ -46,7 +46,15 @@ rctl::set(){ [ -z "${_pid}" ] && return 1 # check for a priority - [ -n "${_pri}" ] && renice ${_pri} ${_pid} >/dev/null 2>&1 + if [ -n "${_pri}" ]; then + if [ "${_pri%%[0-9]*}" = "i" ]; then + idprio ${_pri#i} -${_pid} >/dev/null 2>&1 + elif [ "${_pri%%[0-9]*}" = "r" ]; then + rtprio ${_pri#r} -${_pid} >/dev/null 2>&1 + else + renice ${_pri} ${_pid} >/dev/null 2>&1 + fi + fi # return if there are no limits [ -z "${_pcpu}${_rbps}${_wbps}${_riops}${_wiops}" ] && return 1 diff --git a/vm.8 b/vm.8 index 798d9780..e3971c42 100644 --- a/vm.8 +++ b/vm.8 @@ -1546,10 +1546,13 @@ Note that although the guest is technically stopped when this process runs, call will still consider the guest locked. .It priority Allows a priority to be set for a guest by using the -.Xr nice 8 -facility. The default value is 0, and has a range from -20, which is the highest +.Xr nice 1 +or +.Xr rtprio 1 +facilities. The default value is 0, and has a range from -20, which is the highest priority, to 20. A priority of 20 will cause the guest to only run when the host -system is idle. +system is idle. Priority values prefixed with "r" or "i" will set realtime or idletime +priorities, respectively. .It limit_pcpu Limit the bhyve process to the specified cpu percentage. .Pp From 705be0de8c32e62e5c02833fdf9ebffbbad699b6 Mon Sep 17 00:00:00 2001 From: Wes Morgan Date: Tue, 31 Oct 2023 23:13:28 -0500 Subject: [PATCH 2/2] Priority Support Add support for realtime and idle time priorities with "rNN" and "iNN" values for priority. --- lib/vm-rctl | 10 +++++++++- vm.8 | 9 ++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/vm-rctl b/lib/vm-rctl index e0245d64..3c106e63 100644 --- a/lib/vm-rctl +++ b/lib/vm-rctl @@ -46,7 +46,15 @@ rctl::set(){ [ -z "${_pid}" ] && return 1 # check for a priority - [ -n "${_pri}" ] && renice ${_pri} ${_pid} >/dev/null 2>&1 + if [ -n "${_pri}" ]; then + if [ "${_pri%%[0-9]*}" = "i" ]; then + idprio ${_pri#i} -${_pid} >/dev/null 2>&1 + elif [ "${_pri%%[0-9]*}" = "r" ]; then + rtprio ${_pri#r} -${_pid} >/dev/null 2>&1 + else + renice ${_pri} ${_pid} >/dev/null 2>&1 + fi + fi # return if there are no limits [ -z "${_pcpu}${_rbps}${_wbps}${_riops}${_wiops}" ] && return 1 diff --git a/vm.8 b/vm.8 index 798d9780..e3971c42 100644 --- a/vm.8 +++ b/vm.8 @@ -1546,10 +1546,13 @@ Note that although the guest is technically stopped when this process runs, call will still consider the guest locked. .It priority Allows a priority to be set for a guest by using the -.Xr nice 8 -facility. The default value is 0, and has a range from -20, which is the highest +.Xr nice 1 +or +.Xr rtprio 1 +facilities. The default value is 0, and has a range from -20, which is the highest priority, to 20. A priority of 20 will cause the guest to only run when the host -system is idle. +system is idle. Priority values prefixed with "r" or "i" will set realtime or idletime +priorities, respectively. .It limit_pcpu Limit the bhyve process to the specified cpu percentage. .Pp