Skip to content

Commit 8bd75c7

Browse files
clrkwllmsIngo Molnar
authored and
Ingo Molnar
committed
sched/rt: Move rt specific bits into new header file
Move rt scheduler definitions out of include/linux/sched.h into new file include/linux/sched/rt.h Signed-off-by: Clark Williams <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent ce0dbbb commit 8bd75c7

22 files changed

+81
-57
lines changed

drivers/spi/spi.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include <linux/of_gpio.h>
3434
#include <linux/pm_runtime.h>
3535
#include <linux/export.h>
36-
#include <linux/sched.h>
36+
#include <linux/sched/rt.h>
3737
#include <linux/delay.h>
3838
#include <linux/kthread.h>
3939
#include <linux/ioport.h>

drivers/staging/csr/bh.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
#include "csr_wifi_hip_unifi.h"
1717
#include "unifi_priv.h"
18-
18+
#include <linux/sched/rt.h>
1919

2020
/*
2121
* ---------------------------------------------------------------------------

drivers/staging/csr/unifi_sme.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "unifi_priv.h"
1616
#include "csr_wifi_hip_unifi.h"
1717
#include "csr_wifi_hip_conversions.h"
18-
18+
#include <linux/sched/rt.h>
1919

2020

2121

drivers/tty/sysrq.c

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1616

1717
#include <linux/sched.h>
18+
#include <linux/sched/rt.h>
1819
#include <linux/interrupt.h>
1920
#include <linux/mm.h>
2021
#include <linux/fs.h>

fs/select.c

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/fs.h>
2727
#include <linux/rcupdate.h>
2828
#include <linux/hrtimer.h>
29+
#include <linux/sched/rt.h>
2930

3031
#include <asm/uaccess.h>
3132

include/linux/sched.h

+2-53
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,7 @@ struct sched_entity {
11641164
/* rq "owned" by this entity/group: */
11651165
struct cfs_rq *my_q;
11661166
#endif
1167+
11671168
/*
11681169
* Load-tracking only depends on SMP, FAIR_GROUP_SCHED dependency below may be
11691170
* removed when useful for applications beyond shares distribution (e.g.
@@ -1191,6 +1192,7 @@ struct sched_rt_entity {
11911192
#endif
11921193
};
11931194

1195+
11941196
struct rcu_node;
11951197

11961198
enum perf_event_task_context {
@@ -1596,37 +1598,6 @@ static inline void set_numabalancing_state(bool enabled)
15961598
}
15971599
#endif
15981600

1599-
/*
1600-
* Priority of a process goes from 0..MAX_PRIO-1, valid RT
1601-
* priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
1602-
* tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
1603-
* values are inverted: lower p->prio value means higher priority.
1604-
*
1605-
* The MAX_USER_RT_PRIO value allows the actual maximum
1606-
* RT priority to be separate from the value exported to
1607-
* user-space. This allows kernel threads to set their
1608-
* priority to a value higher than any user task. Note:
1609-
* MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
1610-
*/
1611-
1612-
#define MAX_USER_RT_PRIO 100
1613-
#define MAX_RT_PRIO MAX_USER_RT_PRIO
1614-
1615-
#define MAX_PRIO (MAX_RT_PRIO + 40)
1616-
#define DEFAULT_PRIO (MAX_RT_PRIO + 20)
1617-
1618-
static inline int rt_prio(int prio)
1619-
{
1620-
if (unlikely(prio < MAX_RT_PRIO))
1621-
return 1;
1622-
return 0;
1623-
}
1624-
1625-
static inline int rt_task(struct task_struct *p)
1626-
{
1627-
return rt_prio(p->prio);
1628-
}
1629-
16301601
static inline struct pid *task_pid(struct task_struct *task)
16311602
{
16321603
return task->pids[PIDTYPE_PID].pid;
@@ -2054,26 +2025,6 @@ static inline void sched_autogroup_fork(struct signal_struct *sig) { }
20542025
static inline void sched_autogroup_exit(struct signal_struct *sig) { }
20552026
#endif
20562027

2057-
#ifdef CONFIG_RT_MUTEXES
2058-
extern int rt_mutex_getprio(struct task_struct *p);
2059-
extern void rt_mutex_setprio(struct task_struct *p, int prio);
2060-
extern void rt_mutex_adjust_pi(struct task_struct *p);
2061-
static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
2062-
{
2063-
return tsk->pi_blocked_on != NULL;
2064-
}
2065-
#else
2066-
static inline int rt_mutex_getprio(struct task_struct *p)
2067-
{
2068-
return p->normal_prio;
2069-
}
2070-
# define rt_mutex_adjust_pi(p) do { } while (0)
2071-
static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
2072-
{
2073-
return false;
2074-
}
2075-
#endif
2076-
20772028
extern bool yield_to(struct task_struct *p, bool preempt);
20782029
extern void set_user_nice(struct task_struct *p, long nice);
20792030
extern int task_prio(const struct task_struct *p);
@@ -2703,8 +2654,6 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
27032654
extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask);
27042655
extern long sched_getaffinity(pid_t pid, struct cpumask *mask);
27052656

2706-
extern void normalize_rt_tasks(void);
2707-
27082657
#ifdef CONFIG_CGROUP_SCHED
27092658

27102659
extern struct task_group root_task_group;

include/linux/sched/rt.h

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#ifndef _SCHED_RT_H
2+
#define _SCHED_RT_H
3+
4+
/*
5+
* Priority of a process goes from 0..MAX_PRIO-1, valid RT
6+
* priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL/SCHED_BATCH
7+
* tasks are in the range MAX_RT_PRIO..MAX_PRIO-1. Priority
8+
* values are inverted: lower p->prio value means higher priority.
9+
*
10+
* The MAX_USER_RT_PRIO value allows the actual maximum
11+
* RT priority to be separate from the value exported to
12+
* user-space. This allows kernel threads to set their
13+
* priority to a value higher than any user task. Note:
14+
* MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
15+
*/
16+
17+
#define MAX_USER_RT_PRIO 100
18+
#define MAX_RT_PRIO MAX_USER_RT_PRIO
19+
20+
#define MAX_PRIO (MAX_RT_PRIO + 40)
21+
#define DEFAULT_PRIO (MAX_RT_PRIO + 20)
22+
23+
static inline int rt_prio(int prio)
24+
{
25+
if (unlikely(prio < MAX_RT_PRIO))
26+
return 1;
27+
return 0;
28+
}
29+
30+
static inline int rt_task(struct task_struct *p)
31+
{
32+
return rt_prio(p->prio);
33+
}
34+
35+
#ifdef CONFIG_RT_MUTEXES
36+
extern int rt_mutex_getprio(struct task_struct *p);
37+
extern void rt_mutex_setprio(struct task_struct *p, int prio);
38+
extern void rt_mutex_adjust_pi(struct task_struct *p);
39+
static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
40+
{
41+
return tsk->pi_blocked_on != NULL;
42+
}
43+
#else
44+
static inline int rt_mutex_getprio(struct task_struct *p)
45+
{
46+
return p->normal_prio;
47+
}
48+
# define rt_mutex_adjust_pi(p) do { } while (0)
49+
static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
50+
{
51+
return false;
52+
}
53+
#endif
54+
55+
extern void normalize_rt_tasks(void);
56+
57+
58+
#endif /* _SCHED_RT_H */

init/init_task.c

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <linux/mqueue.h>
44
#include <linux/sched.h>
55
#include <linux/sched/sysctl.h>
6+
#include <linux/sched/rt.h>
67
#include <linux/init.h>
78
#include <linux/fs.h>
89
#include <linux/mm.h>

kernel/futex.c

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#include <linux/pid.h>
6161
#include <linux/nsproxy.h>
6262
#include <linux/ptrace.h>
63+
#include <linux/sched/rt.h>
6364

6465
#include <asm/futex.h>
6566

kernel/hrtimer.c

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include <linux/debugobjects.h>
4646
#include <linux/sched.h>
4747
#include <linux/sched/sysctl.h>
48+
#include <linux/sched/rt.h>
4849
#include <linux/timer.h>
4950

5051
#include <asm/uaccess.h>

kernel/irq/manage.c

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/interrupt.h>
1717
#include <linux/slab.h>
1818
#include <linux/sched.h>
19+
#include <linux/sched/rt.h>
1920
#include <linux/task_work.h>
2021

2122
#include "internals.h"

kernel/mutex.c

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020
#include <linux/mutex.h>
2121
#include <linux/sched.h>
22+
#include <linux/sched/rt.h>
2223
#include <linux/export.h>
2324
#include <linux/spinlock.h>
2425
#include <linux/interrupt.h>

kernel/rtmutex-debug.c

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* See rt.c in preempt-rt for proper credits and further information
1818
*/
1919
#include <linux/sched.h>
20+
#include <linux/sched/rt.h>
2021
#include <linux/delay.h>
2122
#include <linux/export.h>
2223
#include <linux/spinlock.h>

kernel/rtmutex-tester.c

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/kthread.h>
1111
#include <linux/export.h>
1212
#include <linux/sched.h>
13+
#include <linux/sched/rt.h>
1314
#include <linux/spinlock.h>
1415
#include <linux/timer.h>
1516
#include <linux/freezer.h>

kernel/rtmutex.c

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/spinlock.h>
1414
#include <linux/export.h>
1515
#include <linux/sched.h>
16+
#include <linux/sched/rt.h>
1617
#include <linux/timer.h>
1718

1819
#include "rtmutex_common.h"

kernel/sched/cpupri.c

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
*/
2929

3030
#include <linux/gfp.h>
31+
#include <linux/sched.h>
32+
#include <linux/sched/rt.h>
3133
#include "cpupri.h"
3234

3335
/* Convert between a 140 based task->prio, and our 102 based cpupri */

kernel/sched/sched.h

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
#include <linux/sched.h>
33
#include <linux/sched/sysctl.h>
4+
#include <linux/sched/rt.h>
45
#include <linux/mutex.h>
56
#include <linux/spinlock.h>
67
#include <linux/stop_machine.h>

kernel/trace/trace.c

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include <linux/poll.h>
4040
#include <linux/nmi.h>
4141
#include <linux/fs.h>
42+
#include <linux/sched/rt.h>
4243

4344
#include "trace.h"
4445
#include "trace_output.h"

kernel/trace/trace_sched_wakeup.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#include <linux/kallsyms.h>
1616
#include <linux/uaccess.h>
1717
#include <linux/ftrace.h>
18+
#include <linux/sched/rt.h>
1819
#include <trace/events/sched.h>
19-
2020
#include "trace.h"
2121

2222
static struct trace_array *wakeup_trace;

kernel/watchdog.c

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/module.h>
2424
#include <linux/sysctl.h>
2525
#include <linux/smpboot.h>
26+
#include <linux/sched/rt.h>
2627

2728
#include <asm/irq_regs.h>
2829
#include <linux/kvm_para.h>

mm/page-writeback.c

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <linux/buffer_head.h> /* __set_page_dirty_buffers */
3636
#include <linux/pagevec.h>
3737
#include <linux/timer.h>
38+
#include <linux/sched/rt.h>
3839
#include <trace/events/writeback.h>
3940

4041
/*

mm/page_alloc.c

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#include <linux/prefetch.h>
5959
#include <linux/migrate.h>
6060
#include <linux/page-debug-flags.h>
61+
#include <linux/sched/rt.h>
6162

6263
#include <asm/tlbflush.h>
6364
#include <asm/div64.h>

0 commit comments

Comments
 (0)