Skip to content

Commit 14f08c9

Browse files
limingming3Daniel Bristot de Oliveira
authored andcommitted
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: b169637 ("rtla: Helper functions for rtla") Signed-off-by: limingming3 <limingming3@lixiang.com> Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
1 parent 61ec586 commit 14f08c9

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

tools/tracing/rtla/src/utils.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,13 +473,13 @@ int parse_prio(char *arg, struct sched_attr *sched_param)
473473
if (prio == INVALID_VAL)
474474
return -1;
475475

476-
if (prio < sched_get_priority_min(SCHED_OTHER))
476+
if (prio < MIN_NICE)
477477
return -1;
478-
if (prio > sched_get_priority_max(SCHED_OTHER))
478+
if (prio > MAX_NICE)
479479
return -1;
480480

481481
sched_param->sched_policy = SCHED_OTHER;
482-
sched_param->sched_priority = prio;
482+
sched_param->sched_nice = prio;
483483
break;
484484
default:
485485
return -1;

tools/tracing/rtla/src/utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
*/
1010
#define BUFF_U64_STR_SIZE 24
1111
#define MAX_PATH 1024
12+
#define MAX_NICE 20
13+
#define MIN_NICE -19
1214

1315
#define container_of(ptr, type, member)({ \
1416
const typeof(((type *)0)->member) *__mptr = (ptr); \

0 commit comments

Comments
 (0)