From: limingming3 <limingming890315@gmail.com>
To: bristot@kernel.org, rostedt@goodmis.org, colin.i.king@gmail.com,
corbet@lwn.net
Cc: juri.lelli@redhat.com, williams@redhat.com, bagasdotme@gmail.com,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
limingming3@lixiang.com
Subject: [PATCH] tools/rtla: Replace setting prio with nice for SCHED_OTHER
Date: Wed, 7 Feb 2024 14:51:42 +0800 [thread overview]
Message-ID: <20240207065142.1753909-1-limingming3@lixiang.com> (raw)
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.
Signed-off-by: limingming3 <limingming3@lixiang.com>
---
tools/tracing/rtla/src/utils.c | 6 +++---
tools/tracing/rtla/src/utils.h | 2 ++
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c
index c769d7b3842c..159de175ebcc 100644
--- a/tools/tracing/rtla/src/utils.c
+++ b/tools/tracing/rtla/src/utils.c
@@ -479,13 +479,13 @@ int parse_prio(char *arg, struct sched_attr *sched_param)
if (prio == INVALID_VAL)
return -1;
- if (prio < sched_get_priority_min(SCHED_OTHER))
+ if (prio < MIN_NICE)
return -1;
- if (prio > sched_get_priority_max(SCHED_OTHER))
+ if (prio > MAX_NICE)
return -1;
sched_param->sched_policy = SCHED_OTHER;
- sched_param->sched_priority = prio;
+ sched_param->sched_nice = prio;
break;
default:
return -1;
diff --git a/tools/tracing/rtla/src/utils.h b/tools/tracing/rtla/src/utils.h
index 04ed1e650495..d44513e6c66a 100644
--- a/tools/tracing/rtla/src/utils.h
+++ b/tools/tracing/rtla/src/utils.h
@@ -9,6 +9,8 @@
*/
#define BUFF_U64_STR_SIZE 24
#define MAX_PATH 1024
+#define MAX_NICE 20
+#define MIN_NICE -19
#define container_of(ptr, type, member)({ \
const typeof(((type *)0)->member) *__mptr = (ptr); \
--
2.25.1
next reply other threads:[~2024-02-07 6:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-07 6:51 limingming3 [this message]
2024-02-08 13:21 ` Daniel Bristot de Oliveira
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240207065142.1753909-1-limingming3@lixiang.com \
--to=limingming890315@gmail.com \
--cc=bagasdotme@gmail.com \
--cc=bristot@kernel.org \
--cc=colin.i.king@gmail.com \
--cc=corbet@lwn.net \
--cc=juri.lelli@redhat.com \
--cc=limingming3@lixiang.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®