Last active
August 29, 2015 14:25
-
-
Save shichao-an/b2a5b77d5841433a66d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* https://github.com/shichao-an/linux-2.6.34.7/blob/master/kernel/sched.c#L89 | |
*/ | |
/* | |
* Convert user-nice values [ -20 ... 0 ... 19 ] | |
* to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ], | |
* and back. | |
*/ | |
#define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20) | |
#define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20) | |
#define TASK_NICE(p) PRIO_TO_NICE((p)->static_prio) | |
/* | |
* 'User priority' is the nice value converted to something we | |
* can work with better when scaling various scheduler parameters, | |
* it's a [ 0 ... 39 ] range. | |
*/ | |
#define USER_PRIO(p) ((p)-MAX_RT_PRIO) | |
#define TASK_USER_PRIO(p) USER_PRIO((p)->static_prio) | |
#define MAX_USER_PRIO (USER_PRIO(MAX_PRIO)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment