From 37f3f0b6a4567b0495a06f6d47073c3805a05b22 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sat, 13 Apr 2024 09:05:44 +0200 Subject: [PATCH] nr-uesoftmodem: don't set priority, check for SYS_NICE The main thread of nr-uesoftmodem (executing main()) is mostly working; it is thus not necessary to set high priority. Instead, the threads created with threadCreate() will receive higher priority, if possible (as determined by the availability of SYS_NICE capability). To inform if SYS_NICE is not present, print a warning in main(). --- executables/nr-uesoftmodem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 15fb1ae838..e588e2f75b 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -456,10 +456,6 @@ ldpc_interface_t ldpc_interface = {0}, ldpc_interface_offload = {0}; int main(int argc, char **argv) { - int set_exe_prio = 1; - if (set_exe_prio) - set_priority(79); - start_background_system(); if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == NULL) { @@ -484,6 +480,10 @@ int main(int argc, char **argv) //randominit (0); set_taus_seed (0); + if (!has_cap_sys_nice()) + LOG_W(UTIL, + "no SYS_NICE capability: cannot set thread priority and affinity, consider running with sudo for optimum performance\n"); + cpuf=get_cpu_freq_GHz(); itti_init(TASK_MAX, tasks_info);