Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/rtla: Replace setting prio with nice for SCHED_OTHER

Since the sched_priority for SCHED_OTHER is always 0, it makes no
sence to set it.
Setting nice for SCHED_OTHER seems more meaningful.

Link: https://lkml.kernel.org/r/20240207065142.1753909-1-limingming3@lixiang.com

Cc: stable@vger.kernel.org
Fixes: b1696371d865 ("rtla: Helper functions for rtla")
Signed-off-by: limingming3 <limingming3@lixiang.com>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>

authored by

limingming3 and committed by
Daniel Bristot de Oliveira
14f08c97 61ec586b

+5 -3
+3 -3
tools/tracing/rtla/src/utils.c
··· 473 473 if (prio == INVALID_VAL) 474 474 return -1; 475 475 476 - if (prio < sched_get_priority_min(SCHED_OTHER)) 476 + if (prio < MIN_NICE) 477 477 return -1; 478 - if (prio > sched_get_priority_max(SCHED_OTHER)) 478 + if (prio > MAX_NICE) 479 479 return -1; 480 480 481 481 sched_param->sched_policy = SCHED_OTHER; 482 - sched_param->sched_priority = prio; 482 + sched_param->sched_nice = prio; 483 483 break; 484 484 default: 485 485 return -1;
+2
tools/tracing/rtla/src/utils.h
··· 9 9 */ 10 10 #define BUFF_U64_STR_SIZE 24 11 11 #define MAX_PATH 1024 12 + #define MAX_NICE 20 13 + #define MIN_NICE -19 12 14 13 15 #define container_of(ptr, type, member)({ \ 14 16 const typeof(((type *)0)->member) *__mptr = (ptr); \