From: tip-bot for Dongsheng Yang <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
peterz@infradead.org, tglx@linutronix.de,
yangds.fnst@cn.fujitsu.com
Subject: [tip:sched/core] sched/prio: Add 3 macros of MAX_NICE, MIN_NICE and NICE_WIDTH in prio.h
Date: Sat, 22 Feb 2014 10:03:35 -0800 [thread overview]
Message-ID: <tip-3ee237dddcd885d4e525791299d62de33b2ca117@git.kernel.org> (raw)
In-Reply-To: <3994e89327b2b15f992277cdf9f409c516f87d1b.1392103744.git.yangds.fnst@cn.fujitsu.com>
Commit-ID: 3ee237dddcd885d4e525791299d62de33b2ca117
Gitweb: http://git.kernel.org/tip/3ee237dddcd885d4e525791299d62de33b2ca117
Author: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
AuthorDate: Tue, 11 Feb 2014 15:34:46 +0800
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 22 Feb 2014 18:14:13 +0100
sched/prio: Add 3 macros of MAX_NICE, MIN_NICE and NICE_WIDTH in prio.h
Currently there is lots of hard coding to 19 and -20, to represent
maximum and minimum of nice values.
This patch add three macros in prio.h for maximum, minimum and width
of nice value, and uses it to remove hardcoded values in prio.h.
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/3994e89327b2b15f992277cdf9f409c516f87d1b.1392103744.git.yangds.fnst@cn.fujitsu.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
[ Collapsed two small patches. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
include/linux/sched/prio.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/linux/sched/prio.h b/include/linux/sched/prio.h
index 1ceaaa1..ac32258 100644
--- a/include/linux/sched/prio.h
+++ b/include/linux/sched/prio.h
@@ -1,6 +1,10 @@
#ifndef _SCHED_PRIO_H
#define _SCHED_PRIO_H
+#define MAX_NICE 19
+#define MIN_NICE -20
+#define NICE_WIDTH (MAX_NICE - MIN_NICE + 1)
+
/*
* Priority of a process goes from 0..MAX_PRIO-1, valid RT
* priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
@@ -17,8 +21,8 @@
#define MAX_USER_RT_PRIO 100
#define MAX_RT_PRIO MAX_USER_RT_PRIO
-#define MAX_PRIO (MAX_RT_PRIO + 40)
-#define DEFAULT_PRIO (MAX_RT_PRIO + 20)
+#define MAX_PRIO (MAX_RT_PRIO + NICE_WIDTH)
+#define DEFAULT_PRIO (MAX_RT_PRIO + NICE_WIDTH / 2)
/*
* Convert user-nice values [ -20 ... 0 ... 19 ]
next prev parent reply other threads:[~2014-02-22 18:04 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-11 7:34 [PATCH 0/9] Add MAX_NICE, MIN_NICE and NICE_WIDTH macros in prio.h Dongsheng Yang
2014-02-11 7:34 ` [PATCH 1/9] sched: Prio: Use DEFAULT_PRIO to define NICE_TO_PRIO and PRIO_TO_NICE Dongsheng Yang
2014-02-21 21:32 ` [tip:sched/core] " tip-bot for Dongsheng Yang
2014-02-22 18:03 ` [tip:sched/core] sched/prio: Use DEFAULT_PRIO to define NICE_TO_PRIO() and PRIO_TO_NICE() tip-bot for Dongsheng Yang
2014-02-11 7:34 ` [PATCH 2/9] sched: prio: Add 3 macros of MAX_NICE, MIN_NICE and NICE_WIDTH in prio.h Dongsheng Yang
2014-02-21 21:33 ` [tip:sched/core] " tip-bot for Dongsheng Yang
2014-02-22 18:03 ` tip-bot for Dongsheng Yang [this message]
2014-02-11 7:34 ` [PATCH 3/9] sched: prio: Use NICE_WIDTH macro to avoid using of hard coding of 40 and 20 " Dongsheng Yang
2014-02-21 21:33 ` [tip:sched/core] " tip-bot for Dongsheng Yang
2014-02-11 7:34 ` [PATCH 4/9] sched: prio: Add spaces before and after operator of '-' Dongsheng Yang
2014-02-21 21:33 ` [tip:sched/core] " tip-bot for Dongsheng Yang
2014-02-11 7:34 ` [PATCH 5/9] rcu: Use MAX_NICE to replace hard coding of 19 Dongsheng Yang
2014-02-11 15:37 ` Josh Triplett
2014-02-11 16:13 ` Paul E. McKenney
2014-02-11 16:42 ` Peter Zijlstra
2014-02-11 17:42 ` Paul E. McKenney
2014-02-21 21:33 ` [tip:sched/core] " tip-bot for Dongsheng Yang
2014-02-22 18:03 ` [tip:sched/core] rcu: Use MAX_NICE to replace hardcoding " tip-bot for Dongsheng Yang
2014-02-11 7:34 ` [PATCH 6/9] sched: Replace hardcoding of -20 and 19 with MIN_NICE and MAX_NICE Dongsheng Yang
2014-02-21 21:33 ` [tip:sched/core] " tip-bot for Dongsheng Yang
2014-02-22 18:03 ` tip-bot for Dongsheng Yang
2014-02-11 7:34 ` [PATCH 7/9] sys: " Dongsheng Yang
2014-02-11 18:27 ` Kees Cook
2014-02-12 3:59 ` Dongsheng Yang
2014-02-12 6:40 ` Kees Cook
2014-02-21 21:34 ` [tip:sched/core] " tip-bot for Dongsheng Yang
2014-02-22 18:04 ` tip-bot for Dongsheng Yang
2014-02-11 7:34 ` [PATCH 8/9] workqueue: " Dongsheng Yang
2014-02-11 17:50 ` Tejun Heo
2014-02-21 21:34 ` [tip:sched/core] " tip-bot for Dongsheng Yang
2014-02-22 18:04 ` tip-bot for Dongsheng Yang
2014-02-11 7:34 ` [PATCH 9/9] trace: Replace hardcoding of 19 with MAX_NICE Dongsheng Yang
2014-02-22 9:05 ` Dongsheng Yang
2014-02-22 9:27 ` Peter Zijlstra
2014-02-24 10:46 ` Peter Zijlstra
2014-02-24 14:08 ` Dongsheng Yang
2014-02-24 14:12 ` [PATCH Resend] " Dongsheng Yang
2014-02-24 14:22 ` Peter Zijlstra
2014-02-24 14:29 ` Steven Rostedt
2014-02-24 14:48 ` Peter Zijlstra
2014-02-27 13:33 ` [tip:sched/core] " tip-bot for Dongsheng Yang
2014-02-14 9:22 ` [PATCH 0/9] Add MAX_NICE, MIN_NICE and NICE_WIDTH macros in prio.h Dongsheng Yang
2014-02-14 9:51 ` Peter Zijlstra
2014-02-14 9:54 ` Dongsheng Yang
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=tip-3ee237dddcd885d4e525791299d62de33b2ca117@git.kernel.org \
--to=tipbot@zytor.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=yangds.fnst@cn.fujitsu.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