Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
6669dc89
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6669dc89
编写于
5月 22, 2014
作者:
I
Ingo Molnar
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'sched/urgent' into sched/core to avoid conflicts with upcoming changes
Signed-off-by:
N
Ingo Molnar
<
mingo@kernel.org
>
上级
ec6e7f40
6acbfb96
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
78 addition
and
31 deletion
+78
-31
kernel/cpu.c
kernel/cpu.c
+4
-2
kernel/sched/core.c
kernel/sched/core.c
+39
-16
kernel/sched/cpudeadline.c
kernel/sched/cpudeadline.c
+24
-9
kernel/sched/cpudeadline.h
kernel/sched/cpudeadline.h
+3
-3
kernel/sched/cpupri.c
kernel/sched/cpupri.c
+7
-0
kernel/sched/cpupri.h
kernel/sched/cpupri.h
+1
-1
未找到文件。
kernel/cpu.c
浏览文件 @
6669dc89
...
...
@@ -726,10 +726,12 @@ void set_cpu_present(unsigned int cpu, bool present)
void
set_cpu_online
(
unsigned
int
cpu
,
bool
online
)
{
if
(
online
)
if
(
online
)
{
cpumask_set_cpu
(
cpu
,
to_cpumask
(
cpu_online_bits
));
else
cpumask_set_cpu
(
cpu
,
to_cpumask
(
cpu_active_bits
));
}
else
{
cpumask_clear_cpu
(
cpu
,
to_cpumask
(
cpu_online_bits
));
}
}
void
set_cpu_active
(
unsigned
int
cpu
,
bool
active
)
...
...
kernel/sched/core.c
浏览文件 @
6669dc89
...
...
@@ -3226,17 +3226,40 @@ __getparam_dl(struct task_struct *p, struct sched_attr *attr)
* We ask for the deadline not being zero, and greater or equal
* than the runtime, as well as the period of being zero or
* greater than deadline. Furthermore, we have to be sure that
* user parameters are above the internal resolution (1us); we
* check sched_runtime only since it is always the smaller one.
* user parameters are above the internal resolution of 1us (we
* check sched_runtime only since it is always the smaller one) and
* below 2^63 ns (we have to check both sched_deadline and
* sched_period, as the latter can be zero).
*/
static
bool
__checkparam_dl
(
const
struct
sched_attr
*
attr
)
{
return
attr
&&
attr
->
sched_deadline
!=
0
&&
(
attr
->
sched_period
==
0
||
(
s64
)(
attr
->
sched_period
-
attr
->
sched_deadline
)
>=
0
)
&&
(
s64
)(
attr
->
sched_deadline
-
attr
->
sched_runtime
)
>=
0
&&
attr
->
sched_runtime
>=
(
2
<<
(
DL_SCALE
-
1
));
/* deadline != 0 */
if
(
attr
->
sched_deadline
==
0
)
return
false
;
/*
* Since we truncate DL_SCALE bits, make sure we're at least
* that big.
*/
if
(
attr
->
sched_runtime
<
(
1ULL
<<
DL_SCALE
))
return
false
;
/*
* Since we use the MSB for wrap-around and sign issues, make
* sure it's not set (mind that period can be equal to zero).
*/
if
(
attr
->
sched_deadline
&
(
1ULL
<<
63
)
||
attr
->
sched_period
&
(
1ULL
<<
63
))
return
false
;
/* runtime <= deadline <= period (if period != 0) */
if
((
attr
->
sched_period
!=
0
&&
attr
->
sched_period
<
attr
->
sched_deadline
)
||
attr
->
sched_deadline
<
attr
->
sched_runtime
)
return
false
;
return
true
;
}
/*
...
...
@@ -3689,8 +3712,12 @@ SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr,
if
(
!
uattr
||
pid
<
0
||
flags
)
return
-
EINVAL
;
if
(
sched_copy_attr
(
uattr
,
&
attr
))
return
-
EFAULT
;
retval
=
sched_copy_attr
(
uattr
,
&
attr
);
if
(
retval
)
return
retval
;
if
(
attr
.
sched_policy
<
0
)
return
-
EINVAL
;
rcu_read_lock
();
retval
=
-
ESRCH
;
...
...
@@ -3740,7 +3767,7 @@ SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid)
*/
SYSCALL_DEFINE2
(
sched_getparam
,
pid_t
,
pid
,
struct
sched_param
__user
*
,
param
)
{
struct
sched_param
lp
;
struct
sched_param
lp
=
{
.
sched_priority
=
0
}
;
struct
task_struct
*
p
;
int
retval
;
...
...
@@ -3757,11 +3784,8 @@ SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param)
if
(
retval
)
goto
out_unlock
;
if
(
task_has_dl_policy
(
p
))
{
retval
=
-
EINVAL
;
goto
out_unlock
;
}
lp
.
sched_priority
=
p
->
rt_priority
;
if
(
task_has_rt_policy
(
p
))
lp
.
sched_priority
=
p
->
rt_priority
;
rcu_read_unlock
();
/*
...
...
@@ -5083,7 +5107,6 @@ static int sched_cpu_active(struct notifier_block *nfb,
unsigned
long
action
,
void
*
hcpu
)
{
switch
(
action
&
~
CPU_TASKS_FROZEN
)
{
case
CPU_STARTING
:
case
CPU_DOWN_FAILED
:
set_cpu_active
((
long
)
hcpu
,
true
);
return
NOTIFY_OK
;
...
...
kernel/sched/cpudeadline.c
浏览文件 @
6669dc89
...
...
@@ -13,6 +13,7 @@
#include <linux/gfp.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include "cpudeadline.h"
static
inline
int
parent
(
int
i
)
...
...
@@ -39,8 +40,10 @@ static void cpudl_exchange(struct cpudl *cp, int a, int b)
{
int
cpu_a
=
cp
->
elements
[
a
].
cpu
,
cpu_b
=
cp
->
elements
[
b
].
cpu
;
swap
(
cp
->
elements
[
a
],
cp
->
elements
[
b
]);
swap
(
cp
->
cpu_to_idx
[
cpu_a
],
cp
->
cpu_to_idx
[
cpu_b
]);
swap
(
cp
->
elements
[
a
].
cpu
,
cp
->
elements
[
b
].
cpu
);
swap
(
cp
->
elements
[
a
].
dl
,
cp
->
elements
[
b
].
dl
);
swap
(
cp
->
elements
[
cpu_a
].
idx
,
cp
->
elements
[
cpu_b
].
idx
);
}
static
void
cpudl_heapify
(
struct
cpudl
*
cp
,
int
idx
)
...
...
@@ -140,7 +143,7 @@ void cpudl_set(struct cpudl *cp, int cpu, u64 dl, int is_valid)
WARN_ON
(
!
cpu_present
(
cpu
));
raw_spin_lock_irqsave
(
&
cp
->
lock
,
flags
);
old_idx
=
cp
->
cpu_to_idx
[
cpu
]
;
old_idx
=
cp
->
elements
[
cpu
].
idx
;
if
(
!
is_valid
)
{
/* remove item */
if
(
old_idx
==
IDX_INVALID
)
{
...
...
@@ -155,8 +158,8 @@ void cpudl_set(struct cpudl *cp, int cpu, u64 dl, int is_valid)
cp
->
elements
[
old_idx
].
dl
=
cp
->
elements
[
cp
->
size
-
1
].
dl
;
cp
->
elements
[
old_idx
].
cpu
=
new_cpu
;
cp
->
size
--
;
cp
->
cpu_to_idx
[
new_cpu
]
=
old_idx
;
cp
->
cpu_to_idx
[
cpu
]
=
IDX_INVALID
;
cp
->
elements
[
new_cpu
].
idx
=
old_idx
;
cp
->
elements
[
cpu
].
idx
=
IDX_INVALID
;
while
(
old_idx
>
0
&&
dl_time_before
(
cp
->
elements
[
parent
(
old_idx
)].
dl
,
cp
->
elements
[
old_idx
].
dl
))
{
...
...
@@ -173,7 +176,7 @@ void cpudl_set(struct cpudl *cp, int cpu, u64 dl, int is_valid)
cp
->
size
++
;
cp
->
elements
[
cp
->
size
-
1
].
dl
=
0
;
cp
->
elements
[
cp
->
size
-
1
].
cpu
=
cpu
;
cp
->
cpu_to_idx
[
cpu
]
=
cp
->
size
-
1
;
cp
->
elements
[
cpu
].
idx
=
cp
->
size
-
1
;
cpudl_change_key
(
cp
,
cp
->
size
-
1
,
dl
);
cpumask_clear_cpu
(
cpu
,
cp
->
free_cpus
);
}
else
{
...
...
@@ -195,10 +198,21 @@ int cpudl_init(struct cpudl *cp)
memset
(
cp
,
0
,
sizeof
(
*
cp
));
raw_spin_lock_init
(
&
cp
->
lock
);
cp
->
size
=
0
;
for
(
i
=
0
;
i
<
NR_CPUS
;
i
++
)
cp
->
cpu_to_idx
[
i
]
=
IDX_INVALID
;
if
(
!
alloc_cpumask_var
(
&
cp
->
free_cpus
,
GFP_KERNEL
))
cp
->
elements
=
kcalloc
(
nr_cpu_ids
,
sizeof
(
struct
cpudl_item
),
GFP_KERNEL
);
if
(
!
cp
->
elements
)
return
-
ENOMEM
;
if
(
!
alloc_cpumask_var
(
&
cp
->
free_cpus
,
GFP_KERNEL
))
{
kfree
(
cp
->
elements
);
return
-
ENOMEM
;
}
for_each_possible_cpu
(
i
)
cp
->
elements
[
i
].
idx
=
IDX_INVALID
;
cpumask_setall
(
cp
->
free_cpus
);
return
0
;
...
...
@@ -211,4 +225,5 @@ int cpudl_init(struct cpudl *cp)
void
cpudl_cleanup
(
struct
cpudl
*
cp
)
{
free_cpumask_var
(
cp
->
free_cpus
);
kfree
(
cp
->
elements
);
}
kernel/sched/cpudeadline.h
浏览文件 @
6669dc89
...
...
@@ -5,17 +5,17 @@
#define IDX_INVALID -1
struct
array
_item
{
struct
cpudl
_item
{
u64
dl
;
int
cpu
;
int
idx
;
};
struct
cpudl
{
raw_spinlock_t
lock
;
int
size
;
int
cpu_to_idx
[
NR_CPUS
];
struct
array_item
elements
[
NR_CPUS
];
cpumask_var_t
free_cpus
;
struct
cpudl_item
*
elements
;
};
...
...
kernel/sched/cpupri.c
浏览文件 @
6669dc89
...
...
@@ -30,6 +30,7 @@
#include <linux/gfp.h>
#include <linux/sched.h>
#include <linux/sched/rt.h>
#include <linux/slab.h>
#include "cpupri.h"
/* Convert between a 140 based task->prio, and our 102 based cpupri */
...
...
@@ -218,8 +219,13 @@ int cpupri_init(struct cpupri *cp)
goto
cleanup
;
}
cp
->
cpu_to_pri
=
kcalloc
(
nr_cpu_ids
,
sizeof
(
int
),
GFP_KERNEL
);
if
(
!
cp
->
cpu_to_pri
)
goto
cleanup
;
for_each_possible_cpu
(
i
)
cp
->
cpu_to_pri
[
i
]
=
CPUPRI_INVALID
;
return
0
;
cleanup:
...
...
@@ -236,6 +242,7 @@ void cpupri_cleanup(struct cpupri *cp)
{
int
i
;
kfree
(
cp
->
cpu_to_pri
);
for
(
i
=
0
;
i
<
CPUPRI_NR_PRIORITIES
;
i
++
)
free_cpumask_var
(
cp
->
pri_to_cpu
[
i
].
mask
);
}
kernel/sched/cpupri.h
浏览文件 @
6669dc89
...
...
@@ -17,7 +17,7 @@ struct cpupri_vec {
struct
cpupri
{
struct
cpupri_vec
pri_to_cpu
[
CPUPRI_NR_PRIORITIES
];
int
cpu_to_pri
[
NR_CPUS
]
;
int
*
cpu_to_pri
;
};
#ifdef CONFIG_SMP
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录