diff options
author | Dongsheng Yang <yangds.fnst@cn.fujitsu.com> | 2014-01-27 17:15:38 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-02-09 07:31:51 -0500 |
commit | 6b6350f155afdfdf888e18c7bf26950a6d10b0c2 (patch) | |
tree | 7a11b997387e666cbfff3f78489d892384c16680 | |
parent | 5c228079ce8a9bb043a423069a6674dfb9268037 (diff) |
sched: Expose some macros related to priority
Some macros in kernel/sched/sched.h about priority are
private to kernel/sched. But they are useful to other
parts of the core kernel.
This patch moves these macros from kernel/sched/sched.h to
include/linux/sched/prio.h so that they are available to
other subsystems.
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Cc: raistlin@linux.it
Cc: juri.lelli@gmail.com
Cc: clark.williams@gmail.com
Cc: rostedt@goodmis.org
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/2b022810905b52d13238466807f4b2a691577180.1390859827.git.yangds.fnst@cn.fujitsu.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | include/linux/sched/prio.h | 18 | ||||
-rw-r--r-- | kernel/sched/sched.h | 18 |
2 files changed, 18 insertions, 18 deletions
diff --git a/include/linux/sched/prio.h b/include/linux/sched/prio.h index 9382ba84d5d0..13216f16762e 100644 --- a/include/linux/sched/prio.h +++ b/include/linux/sched/prio.h | |||
@@ -20,4 +20,22 @@ | |||
20 | #define MAX_PRIO (MAX_RT_PRIO + 40) | 20 | #define MAX_PRIO (MAX_RT_PRIO + 40) |
21 | #define DEFAULT_PRIO (MAX_RT_PRIO + 20) | 21 | #define DEFAULT_PRIO (MAX_RT_PRIO + 20) |
22 | 22 | ||
23 | /* | ||
24 | * Convert user-nice values [ -20 ... 0 ... 19 ] | ||
25 | * to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ], | ||
26 | * and back. | ||
27 | */ | ||
28 | #define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20) | ||
29 | #define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20) | ||
30 | #define TASK_NICE(p) PRIO_TO_NICE((p)->static_prio) | ||
31 | |||
32 | /* | ||
33 | * 'User priority' is the nice value converted to something we | ||
34 | * can work with better when scaling various scheduler parameters, | ||
35 | * it's a [ 0 ... 39 ] range. | ||
36 | */ | ||
37 | #define USER_PRIO(p) ((p)-MAX_RT_PRIO) | ||
38 | #define TASK_USER_PRIO(p) USER_PRIO((p)->static_prio) | ||
39 | #define MAX_USER_PRIO (USER_PRIO(MAX_PRIO)) | ||
40 | |||
23 | #endif /* _SCHED_PRIO_H */ | 41 | #endif /* _SCHED_PRIO_H */ |
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index c2119fd20f8b..b44720d38ae9 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h | |||
@@ -24,24 +24,6 @@ extern long calc_load_fold_active(struct rq *this_rq); | |||
24 | extern void update_cpu_load_active(struct rq *this_rq); | 24 | extern void update_cpu_load_active(struct rq *this_rq); |
25 | 25 | ||
26 | /* | 26 | /* |
27 | * Convert user-nice values [ -20 ... 0 ... 19 ] | ||
28 | * to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ], | ||
29 | * and back. | ||
30 | */ | ||
31 | #define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20) | ||
32 | #define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20) | ||
33 | #define TASK_NICE(p) PRIO_TO_NICE((p)->static_prio) | ||
34 | |||
35 | /* | ||
36 | * 'User priority' is the nice value converted to something we | ||
37 | * can work with better when scaling various scheduler parameters, | ||
38 | * it's a [ 0 ... 39 ] range. | ||
39 | */ | ||
40 | #define USER_PRIO(p) ((p)-MAX_RT_PRIO) | ||
41 | #define TASK_USER_PRIO(p) USER_PRIO((p)->static_prio) | ||
42 | #define MAX_USER_PRIO (USER_PRIO(MAX_PRIO)) | ||
43 | |||
44 | /* | ||
45 | * Helpers for converting nanosecond timing to jiffy resolution | 27 | * Helpers for converting nanosecond timing to jiffy resolution |
46 | */ | 28 | */ |
47 | #define NS_TO_JIFFIES(TIME) ((unsigned long)(TIME) / (NSEC_PER_SEC / HZ)) | 29 | #define NS_TO_JIFFIES(TIME) ((unsigned long)(TIME) / (NSEC_PER_SEC / HZ)) |