2019-05-03 03:15:01 +08:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
|
2020-03-03 20:48:27 +08:00
|
|
|
START=90
|
|
|
|
STOP=10
|
|
|
|
|
2019-05-03 03:15:01 +08:00
|
|
|
USE_PROCD=1
|
|
|
|
|
2020-03-03 20:48:27 +08:00
|
|
|
service_triggers()
|
|
|
|
{
|
|
|
|
procd_add_reload_trigger "irqbalance"
|
|
|
|
}
|
|
|
|
|
2019-05-03 03:15:01 +08:00
|
|
|
start_service() {
|
2019-06-02 17:29:17 +08:00
|
|
|
local enabled
|
|
|
|
config_load 'irqbalance'
|
|
|
|
config_get_bool enabled irqbalance enabled 0
|
|
|
|
[ "$enabled" -gt 0 ] || return 0
|
|
|
|
|
2022-06-23 16:09:13 +08:00
|
|
|
config_get deepestcache irqbalance deepestcache 2
|
2020-02-24 06:53:11 +08:00
|
|
|
config_get interval irqbalance interval 10
|
2023-08-05 15:01:49 +08:00
|
|
|
config_get banned_cpulist irqbalance banned_cpulist ''
|
2024-02-28 19:50:10 +08:00
|
|
|
config_get debug irqbalance debug 0
|
|
|
|
|
|
|
|
procd_open_instance "irqbalance"
|
|
|
|
if [ -n "$banned_cpulist" ]; then
|
|
|
|
procd_set_param env IRQBALANCE_BANNED_CPULIST="$banned_cpulist"
|
|
|
|
fi
|
|
|
|
|
|
|
|
procd_add_jail_mount_rw /proc
|
|
|
|
procd_set_param command /usr/sbin/irqbalance
|
|
|
|
procd_append_param command -f
|
|
|
|
procd_append_param command "-c $deepestcache"
|
|
|
|
procd_append_param command "-t $interval"
|
2023-08-05 15:01:49 +08:00
|
|
|
|
2024-02-28 19:50:10 +08:00
|
|
|
# add banned IRQs
|
2020-02-24 06:53:11 +08:00
|
|
|
handle_banirq_value()
|
|
|
|
{
|
2024-02-28 19:50:10 +08:00
|
|
|
procd_append_param command "-i $1"
|
2020-02-24 06:53:11 +08:00
|
|
|
}
|
|
|
|
config_list_foreach irqbalance banirq handle_banirq_value
|
|
|
|
|
2024-02-28 19:50:10 +08:00
|
|
|
# debug
|
|
|
|
if [ "$debug" -gt 0 ]; then
|
|
|
|
procd_append_param command -d
|
|
|
|
procd_set_param stdout 1
|
2023-08-05 15:01:49 +08:00
|
|
|
fi
|
2024-02-28 19:50:10 +08:00
|
|
|
procd_set_param stderr 1
|
|
|
|
|
2019-06-02 17:29:17 +08:00
|
|
|
procd_set_param respawn
|
|
|
|
procd_close_instance
|
2019-05-03 03:15:01 +08:00
|
|
|
}
|