aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/cpumask.h16
-rw-r--r--include/linux/ioprio.h3
-rw-r--r--include/linux/sched.h19
-rw-r--r--include/linux/sched/isolation.h51
-rw-r--r--include/linux/sched/rt.h11
-rw-r--r--include/linux/sched/sysctl.h6
-rw-r--r--include/linux/tick.h39
-rw-r--r--include/trace/events/sched.h2
8 files changed, 96 insertions, 51 deletions
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 8d3125c493b2..75b565194437 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -131,6 +131,11 @@ static inline unsigned int cpumask_first(const struct cpumask *srcp)
131 return 0; 131 return 0;
132} 132}
133 133
134static inline unsigned int cpumask_last(const struct cpumask *srcp)
135{
136 return 0;
137}
138
134/* Valid inputs for n are -1 and 0. */ 139/* Valid inputs for n are -1 and 0. */
135static inline unsigned int cpumask_next(int n, const struct cpumask *srcp) 140static inline unsigned int cpumask_next(int n, const struct cpumask *srcp)
136{ 141{
@@ -179,6 +184,17 @@ static inline unsigned int cpumask_first(const struct cpumask *srcp)
179 return find_first_bit(cpumask_bits(srcp), nr_cpumask_bits); 184 return find_first_bit(cpumask_bits(srcp), nr_cpumask_bits);
180} 185}
181 186
187/**
188 * cpumask_last - get the last CPU in a cpumask
189 * @srcp: - the cpumask pointer
190 *
191 * Returns >= nr_cpumask_bits if no CPUs set.
192 */
193static inline unsigned int cpumask_last(const struct cpumask *srcp)
194{
195 return find_last_bit(cpumask_bits(srcp), nr_cpumask_bits);
196}
197
182unsigned int cpumask_next(int n, const struct cpumask *srcp); 198unsigned int cpumask_next(int n, const struct cpumask *srcp);
183 199
184/** 200/**
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
index 2cdd74809899..627efac73e6d 100644
--- a/include/linux/ioprio.h
+++ b/include/linux/ioprio.h
@@ -3,6 +3,7 @@
3#define IOPRIO_H 3#define IOPRIO_H
4 4
5#include <linux/sched.h> 5#include <linux/sched.h>
6#include <linux/sched/rt.h>
6#include <linux/iocontext.h> 7#include <linux/iocontext.h>
7 8
8/* 9/*
@@ -63,7 +64,7 @@ static inline int task_nice_ioclass(struct task_struct *task)
63{ 64{
64 if (task->policy == SCHED_IDLE) 65 if (task->policy == SCHED_IDLE)
65 return IOPRIO_CLASS_IDLE; 66 return IOPRIO_CLASS_IDLE;
66 else if (task->policy == SCHED_FIFO || task->policy == SCHED_RR) 67 else if (task_is_realtime(task))
67 return IOPRIO_CLASS_RT; 68 return IOPRIO_CLASS_RT;
68 else 69 else
69 return IOPRIO_CLASS_BE; 70 return IOPRIO_CLASS_BE;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index fdf74f27acf1..a5dc7c98b0a2 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -166,8 +166,6 @@ struct task_group;
166/* Task command name length: */ 166/* Task command name length: */
167#define TASK_COMM_LEN 16 167#define TASK_COMM_LEN 16
168 168
169extern cpumask_var_t cpu_isolated_map;
170
171extern void scheduler_tick(void); 169extern void scheduler_tick(void);
172 170
173#define MAX_SCHEDULE_TIMEOUT LONG_MAX 171#define MAX_SCHEDULE_TIMEOUT LONG_MAX
@@ -332,9 +330,11 @@ struct load_weight {
332struct sched_avg { 330struct sched_avg {
333 u64 last_update_time; 331 u64 last_update_time;
334 u64 load_sum; 332 u64 load_sum;
333 u64 runnable_load_sum;
335 u32 util_sum; 334 u32 util_sum;
336 u32 period_contrib; 335 u32 period_contrib;
337 unsigned long load_avg; 336 unsigned long load_avg;
337 unsigned long runnable_load_avg;
338 unsigned long util_avg; 338 unsigned long util_avg;
339}; 339};
340 340
@@ -377,6 +377,7 @@ struct sched_statistics {
377struct sched_entity { 377struct sched_entity {
378 /* For load-balancing: */ 378 /* For load-balancing: */
379 struct load_weight load; 379 struct load_weight load;
380 unsigned long runnable_weight;
380 struct rb_node run_node; 381 struct rb_node run_node;
381 struct list_head group_node; 382 struct list_head group_node;
382 unsigned int on_rq; 383 unsigned int on_rq;
@@ -472,10 +473,10 @@ struct sched_dl_entity {
472 * conditions between the inactive timer handler and the wakeup 473 * conditions between the inactive timer handler and the wakeup
473 * code. 474 * code.
474 */ 475 */
475 int dl_throttled; 476 int dl_throttled : 1;
476 int dl_boosted; 477 int dl_boosted : 1;
477 int dl_yielded; 478 int dl_yielded : 1;
478 int dl_non_contending; 479 int dl_non_contending : 1;
479 480
480 /* 481 /*
481 * Bandwidth enforcement timer. Each -deadline task has its 482 * Bandwidth enforcement timer. Each -deadline task has its
@@ -1246,7 +1247,7 @@ static inline pid_t task_pgrp_nr(struct task_struct *tsk)
1246#define TASK_REPORT_IDLE (TASK_REPORT + 1) 1247#define TASK_REPORT_IDLE (TASK_REPORT + 1)
1247#define TASK_REPORT_MAX (TASK_REPORT_IDLE << 1) 1248#define TASK_REPORT_MAX (TASK_REPORT_IDLE << 1)
1248 1249
1249static inline unsigned int __get_task_state(struct task_struct *tsk) 1250static inline unsigned int task_state_index(struct task_struct *tsk)
1250{ 1251{
1251 unsigned int tsk_state = READ_ONCE(tsk->state); 1252 unsigned int tsk_state = READ_ONCE(tsk->state);
1252 unsigned int state = (tsk_state | tsk->exit_state) & TASK_REPORT; 1253 unsigned int state = (tsk_state | tsk->exit_state) & TASK_REPORT;
@@ -1259,7 +1260,7 @@ static inline unsigned int __get_task_state(struct task_struct *tsk)
1259 return fls(state); 1260 return fls(state);
1260} 1261}
1261 1262
1262static inline char __task_state_to_char(unsigned int state) 1263static inline char task_index_to_char(unsigned int state)
1263{ 1264{
1264 static const char state_char[] = "RSDTtXZPI"; 1265 static const char state_char[] = "RSDTtXZPI";
1265 1266
@@ -1270,7 +1271,7 @@ static inline char __task_state_to_char(unsigned int state)
1270 1271
1271static inline char task_state_to_char(struct task_struct *tsk) 1272static inline char task_state_to_char(struct task_struct *tsk)
1272{ 1273{
1273 return __task_state_to_char(__get_task_state(tsk)); 1274 return task_index_to_char(task_state_index(tsk));
1274} 1275}
1275 1276
1276/** 1277/**
diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h
new file mode 100644
index 000000000000..d849431c8060
--- /dev/null
+++ b/include/linux/sched/isolation.h
@@ -0,0 +1,51 @@
1#ifndef _LINUX_SCHED_ISOLATION_H
2#define _LINUX_SCHED_ISOLATION_H
3
4#include <linux/cpumask.h>
5#include <linux/init.h>
6#include <linux/tick.h>
7
8enum hk_flags {
9 HK_FLAG_TIMER = 1,
10 HK_FLAG_RCU = (1 << 1),
11 HK_FLAG_MISC = (1 << 2),
12 HK_FLAG_SCHED = (1 << 3),
13 HK_FLAG_TICK = (1 << 4),
14 HK_FLAG_DOMAIN = (1 << 5),
15};
16
17#ifdef CONFIG_CPU_ISOLATION
18DECLARE_STATIC_KEY_FALSE(housekeeping_overriden);
19extern int housekeeping_any_cpu(enum hk_flags flags);
20extern const struct cpumask *housekeeping_cpumask(enum hk_flags flags);
21extern void housekeeping_affine(struct task_struct *t, enum hk_flags flags);
22extern bool housekeeping_test_cpu(int cpu, enum hk_flags flags);
23extern void __init housekeeping_init(void);
24
25#else
26
27static inline int housekeeping_any_cpu(enum hk_flags flags)
28{
29 return smp_processor_id();
30}
31
32static inline const struct cpumask *housekeeping_cpumask(enum hk_flags flags)
33{
34 return cpu_possible_mask;
35}
36
37static inline void housekeeping_affine(struct task_struct *t,
38 enum hk_flags flags) { }
39static inline void housekeeping_init(void) { }
40#endif /* CONFIG_CPU_ISOLATION */
41
42static inline bool housekeeping_cpu(int cpu, enum hk_flags flags)
43{
44#ifdef CONFIG_CPU_ISOLATION
45 if (static_branch_unlikely(&housekeeping_overriden))
46 return housekeeping_test_cpu(cpu, flags);
47#endif
48 return true;
49}
50
51#endif /* _LINUX_SCHED_ISOLATION_H */
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h
index db865ed25ef3..e5af028c08b4 100644
--- a/