Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
c68cfdc0
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
c68cfdc0
编写于
11月 18, 2014
作者:
R
Rafael J. Wysocki
浏览文件
操作
浏览文件
下载
差异文件
Merge back 'pm-sleep' material for 3.19-rc1.
上级
fc14f9c1
db597605
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
33 addition
and
34 deletion
+33
-34
kernel/power/hibernate.c
kernel/power/hibernate.c
+6
-8
kernel/power/power.h
kernel/power/power.h
+1
-2
kernel/power/snapshot.c
kernel/power/snapshot.c
+5
-4
kernel/power/swap.c
kernel/power/swap.c
+21
-20
未找到文件。
kernel/power/hibernate.c
浏览文件 @
c68cfdc0
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include <linux/syscore_ops.h>
#include <linux/syscore_ops.h>
#include <linux/ctype.h>
#include <linux/ctype.h>
#include <linux/genhd.h>
#include <linux/genhd.h>
#include <linux/ktime.h>
#include <trace/events/power.h>
#include <trace/events/power.h>
#include "power.h"
#include "power.h"
...
@@ -232,20 +233,17 @@ static void platform_recover(int platform_mode)
...
@@ -232,20 +233,17 @@ static void platform_recover(int platform_mode)
* @nr_pages: Number of memory pages processed between @start and @stop.
* @nr_pages: Number of memory pages processed between @start and @stop.
* @msg: Additional diagnostic message to print.
* @msg: Additional diagnostic message to print.
*/
*/
void
swsusp_show_speed
(
struct
timeval
*
start
,
struct
timeval
*
stop
,
void
swsusp_show_speed
(
ktime_t
start
,
ktime_t
stop
,
unsigned
nr_pages
,
char
*
msg
)
unsigned
nr_pages
,
char
*
msg
)
{
{
ktime_t
diff
;
u64
elapsed_centisecs64
;
u64
elapsed_centisecs64
;
unsigned
int
centisecs
;
unsigned
int
centisecs
;
unsigned
int
k
;
unsigned
int
k
;
unsigned
int
kps
;
unsigned
int
kps
;
elapsed_centisecs64
=
timeval_to_ns
(
stop
)
-
timeval_to_ns
(
start
);
diff
=
ktime_sub
(
stop
,
start
);
/*
elapsed_centisecs64
=
ktime_divns
(
diff
,
10
*
NSEC_PER_MSEC
);
* If "(s64)elapsed_centisecs64 < 0", it will print long elapsed time,
* it is obvious enough for what went wrong.
*/
do_div
(
elapsed_centisecs64
,
NSEC_PER_SEC
/
100
);
centisecs
=
elapsed_centisecs64
;
centisecs
=
elapsed_centisecs64
;
if
(
centisecs
==
0
)
if
(
centisecs
==
0
)
centisecs
=
1
;
/* avoid div-by-zero */
centisecs
=
1
;
/* avoid div-by-zero */
...
...
kernel/power/power.h
浏览文件 @
c68cfdc0
...
@@ -174,8 +174,7 @@ extern int hib_wait_on_bio_chain(struct bio **bio_chain);
...
@@ -174,8 +174,7 @@ extern int hib_wait_on_bio_chain(struct bio **bio_chain);
struct
timeval
;
struct
timeval
;
/* kernel/power/swsusp.c */
/* kernel/power/swsusp.c */
extern
void
swsusp_show_speed
(
struct
timeval
*
,
struct
timeval
*
,
extern
void
swsusp_show_speed
(
ktime_t
,
ktime_t
,
unsigned
int
,
char
*
);
unsigned
int
,
char
*
);
#ifdef CONFIG_SUSPEND
#ifdef CONFIG_SUSPEND
/* kernel/power/suspend.c */
/* kernel/power/suspend.c */
...
...
kernel/power/snapshot.c
浏览文件 @
c68cfdc0
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include <linux/list.h>
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/compiler.h>
#include <linux/compiler.h>
#include <linux/ktime.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/mmu_context.h>
#include <asm/mmu_context.h>
...
@@ -1576,11 +1577,11 @@ int hibernate_preallocate_memory(void)
...
@@ -1576,11 +1577,11 @@ int hibernate_preallocate_memory(void)
struct
zone
*
zone
;
struct
zone
*
zone
;
unsigned
long
saveable
,
size
,
max_size
,
count
,
highmem
,
pages
=
0
;
unsigned
long
saveable
,
size
,
max_size
,
count
,
highmem
,
pages
=
0
;
unsigned
long
alloc
,
save_highmem
,
pages_highmem
,
avail_normal
;
unsigned
long
alloc
,
save_highmem
,
pages_highmem
,
avail_normal
;
struct
timeval
start
,
stop
;
ktime_t
start
,
stop
;
int
error
;
int
error
;
printk
(
KERN_INFO
"PM: Preallocating image memory... "
);
printk
(
KERN_INFO
"PM: Preallocating image memory... "
);
do_gettimeofday
(
&
start
);
start
=
ktime_get
(
);
error
=
memory_bm_create
(
&
orig_bm
,
GFP_IMAGE
,
PG_ANY
);
error
=
memory_bm_create
(
&
orig_bm
,
GFP_IMAGE
,
PG_ANY
);
if
(
error
)
if
(
error
)
...
@@ -1709,9 +1710,9 @@ int hibernate_preallocate_memory(void)
...
@@ -1709,9 +1710,9 @@ int hibernate_preallocate_memory(void)
free_unnecessary_pages
();
free_unnecessary_pages
();
out:
out:
do_gettimeofday
(
&
stop
);
stop
=
ktime_get
(
);
printk
(
KERN_CONT
"done (allocated %lu pages)
\n
"
,
pages
);
printk
(
KERN_CONT
"done (allocated %lu pages)
\n
"
,
pages
);
swsusp_show_speed
(
&
start
,
&
stop
,
pages
,
"Allocated"
);
swsusp_show_speed
(
start
,
stop
,
pages
,
"Allocated"
);
return
0
;
return
0
;
...
...
kernel/power/swap.c
浏览文件 @
c68cfdc0
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
#include <linux/atomic.h>
#include <linux/atomic.h>
#include <linux/kthread.h>
#include <linux/kthread.h>
#include <linux/crc32.h>
#include <linux/crc32.h>
#include <linux/ktime.h>
#include "power.h"
#include "power.h"
...
@@ -445,8 +446,8 @@ static int save_image(struct swap_map_handle *handle,
...
@@ -445,8 +446,8 @@ static int save_image(struct swap_map_handle *handle,
int
nr_pages
;
int
nr_pages
;
int
err2
;
int
err2
;
struct
bio
*
bio
;
struct
bio
*
bio
;
struct
timeval
start
;
ktime_t
start
;
struct
timeval
stop
;
ktime_t
stop
;
printk
(
KERN_INFO
"PM: Saving image data pages (%u pages)...
\n
"
,
printk
(
KERN_INFO
"PM: Saving image data pages (%u pages)...
\n
"
,
nr_to_write
);
nr_to_write
);
...
@@ -455,7 +456,7 @@ static int save_image(struct swap_map_handle *handle,
...
@@ -455,7 +456,7 @@ static int save_image(struct swap_map_handle *handle,
m
=
1
;
m
=
1
;
nr_pages
=
0
;
nr_pages
=
0
;
bio
=
NULL
;
bio
=
NULL
;
do_gettimeofday
(
&
start
);
start
=
ktime_get
(
);
while
(
1
)
{
while
(
1
)
{
ret
=
snapshot_read_next
(
snapshot
);
ret
=
snapshot_read_next
(
snapshot
);
if
(
ret
<=
0
)
if
(
ret
<=
0
)
...
@@ -469,12 +470,12 @@ static int save_image(struct swap_map_handle *handle,
...
@@ -469,12 +470,12 @@ static int save_image(struct swap_map_handle *handle,
nr_pages
++
;
nr_pages
++
;
}
}
err2
=
hib_wait_on_bio_chain
(
&
bio
);
err2
=
hib_wait_on_bio_chain
(
&
bio
);
do_gettimeofday
(
&
stop
);
stop
=
ktime_get
(
);
if
(
!
ret
)
if
(
!
ret
)
ret
=
err2
;
ret
=
err2
;
if
(
!
ret
)
if
(
!
ret
)
printk
(
KERN_INFO
"PM: Image saving done.
\n
"
);
printk
(
KERN_INFO
"PM: Image saving done.
\n
"
);
swsusp_show_speed
(
&
start
,
&
stop
,
nr_to_write
,
"Wrote"
);
swsusp_show_speed
(
start
,
stop
,
nr_to_write
,
"Wrote"
);
return
ret
;
return
ret
;
}
}
...
@@ -580,8 +581,8 @@ static int save_image_lzo(struct swap_map_handle *handle,
...
@@ -580,8 +581,8 @@ static int save_image_lzo(struct swap_map_handle *handle,
int
nr_pages
;
int
nr_pages
;
int
err2
;
int
err2
;
struct
bio
*
bio
;
struct
bio
*
bio
;
struct
timeval
start
;
ktime_t
start
;
struct
timeval
stop
;
ktime_t
stop
;
size_t
off
;
size_t
off
;
unsigned
thr
,
run_threads
,
nr_threads
;
unsigned
thr
,
run_threads
,
nr_threads
;
unsigned
char
*
page
=
NULL
;
unsigned
char
*
page
=
NULL
;
...
@@ -674,7 +675,7 @@ static int save_image_lzo(struct swap_map_handle *handle,
...
@@ -674,7 +675,7 @@ static int save_image_lzo(struct swap_map_handle *handle,
m
=
1
;
m
=
1
;
nr_pages
=
0
;
nr_pages
=
0
;
bio
=
NULL
;
bio
=
NULL
;
do_gettimeofday
(
&
start
);
start
=
ktime_get
(
);
for
(;;)
{
for
(;;)
{
for
(
thr
=
0
;
thr
<
nr_threads
;
thr
++
)
{
for
(
thr
=
0
;
thr
<
nr_threads
;
thr
++
)
{
for
(
off
=
0
;
off
<
LZO_UNC_SIZE
;
off
+=
PAGE_SIZE
)
{
for
(
off
=
0
;
off
<
LZO_UNC_SIZE
;
off
+=
PAGE_SIZE
)
{
...
@@ -759,12 +760,12 @@ static int save_image_lzo(struct swap_map_handle *handle,
...
@@ -759,12 +760,12 @@ static int save_image_lzo(struct swap_map_handle *handle,
out_finish:
out_finish:
err2
=
hib_wait_on_bio_chain
(
&
bio
);
err2
=
hib_wait_on_bio_chain
(
&
bio
);
do_gettimeofday
(
&
stop
);
stop
=
ktime_get
(
);
if
(
!
ret
)
if
(
!
ret
)
ret
=
err2
;
ret
=
err2
;
if
(
!
ret
)
if
(
!
ret
)
printk
(
KERN_INFO
"PM: Image saving done.
\n
"
);
printk
(
KERN_INFO
"PM: Image saving done.
\n
"
);
swsusp_show_speed
(
&
start
,
&
stop
,
nr_to_write
,
"Wrote"
);
swsusp_show_speed
(
start
,
stop
,
nr_to_write
,
"Wrote"
);
out_clean:
out_clean:
if
(
crc
)
{
if
(
crc
)
{
if
(
crc
->
thr
)
if
(
crc
->
thr
)
...
@@ -965,8 +966,8 @@ static int load_image(struct swap_map_handle *handle,
...
@@ -965,8 +966,8 @@ static int load_image(struct swap_map_handle *handle,
{
{
unsigned
int
m
;
unsigned
int
m
;
int
ret
=
0
;
int
ret
=
0
;
struct
timeval
start
;
ktime_t
start
;
struct
timeval
stop
;
ktime_t
stop
;
struct
bio
*
bio
;
struct
bio
*
bio
;
int
err2
;
int
err2
;
unsigned
nr_pages
;
unsigned
nr_pages
;
...
@@ -978,7 +979,7 @@ static int load_image(struct swap_map_handle *handle,
...
@@ -978,7 +979,7 @@ static int load_image(struct swap_map_handle *handle,
m
=
1
;
m
=
1
;
nr_pages
=
0
;
nr_pages
=
0
;
bio
=
NULL
;
bio
=
NULL
;
do_gettimeofday
(
&
start
);
start
=
ktime_get
(
);
for
(
;
;
)
{
for
(
;
;
)
{
ret
=
snapshot_write_next
(
snapshot
);
ret
=
snapshot_write_next
(
snapshot
);
if
(
ret
<=
0
)
if
(
ret
<=
0
)
...
@@ -996,7 +997,7 @@ static int load_image(struct swap_map_handle *handle,
...
@@ -996,7 +997,7 @@ static int load_image(struct swap_map_handle *handle,
nr_pages
++
;
nr_pages
++
;
}
}
err2
=
hib_wait_on_bio_chain
(
&
bio
);
err2
=
hib_wait_on_bio_chain
(
&
bio
);
do_gettimeofday
(
&
stop
);
stop
=
ktime_get
(
);
if
(
!
ret
)
if
(
!
ret
)
ret
=
err2
;
ret
=
err2
;
if
(
!
ret
)
{
if
(
!
ret
)
{
...
@@ -1005,7 +1006,7 @@ static int load_image(struct swap_map_handle *handle,
...
@@ -1005,7 +1006,7 @@ static int load_image(struct swap_map_handle *handle,
if
(
!
snapshot_image_loaded
(
snapshot
))
if
(
!
snapshot_image_loaded
(
snapshot
))
ret
=
-
ENODATA
;
ret
=
-
ENODATA
;
}
}
swsusp_show_speed
(
&
start
,
&
stop
,
nr_to_read
,
"Read"
);
swsusp_show_speed
(
start
,
stop
,
nr_to_read
,
"Read"
);
return
ret
;
return
ret
;
}
}
...
@@ -1067,8 +1068,8 @@ static int load_image_lzo(struct swap_map_handle *handle,
...
@@ -1067,8 +1068,8 @@ static int load_image_lzo(struct swap_map_handle *handle,
int
ret
=
0
;
int
ret
=
0
;
int
eof
=
0
;
int
eof
=
0
;
struct
bio
*
bio
;
struct
bio
*
bio
;
struct
timeval
start
;
ktime_t
start
;
struct
timeval
stop
;
ktime_t
stop
;
unsigned
nr_pages
;
unsigned
nr_pages
;
size_t
off
;
size_t
off
;
unsigned
i
,
thr
,
run_threads
,
nr_threads
;
unsigned
i
,
thr
,
run_threads
,
nr_threads
;
...
@@ -1190,7 +1191,7 @@ static int load_image_lzo(struct swap_map_handle *handle,
...
@@ -1190,7 +1191,7 @@ static int load_image_lzo(struct swap_map_handle *handle,
m
=
1
;
m
=
1
;
nr_pages
=
0
;
nr_pages
=
0
;
bio
=
NULL
;
bio
=
NULL
;
do_gettimeofday
(
&
start
);
start
=
ktime_get
(
);
ret
=
snapshot_write_next
(
snapshot
);
ret
=
snapshot_write_next
(
snapshot
);
if
(
ret
<=
0
)
if
(
ret
<=
0
)
...
@@ -1343,7 +1344,7 @@ static int load_image_lzo(struct swap_map_handle *handle,
...
@@ -1343,7 +1344,7 @@ static int load_image_lzo(struct swap_map_handle *handle,
wait_event
(
crc
->
done
,
atomic_read
(
&
crc
->
stop
));
wait_event
(
crc
->
done
,
atomic_read
(
&
crc
->
stop
));
atomic_set
(
&
crc
->
stop
,
0
);
atomic_set
(
&
crc
->
stop
,
0
);
}
}
do_gettimeofday
(
&
stop
);
stop
=
ktime_get
(
);
if
(
!
ret
)
{
if
(
!
ret
)
{
printk
(
KERN_INFO
"PM: Image loading done.
\n
"
);
printk
(
KERN_INFO
"PM: Image loading done.
\n
"
);
snapshot_write_finalize
(
snapshot
);
snapshot_write_finalize
(
snapshot
);
...
@@ -1359,7 +1360,7 @@ static int load_image_lzo(struct swap_map_handle *handle,
...
@@ -1359,7 +1360,7 @@ static int load_image_lzo(struct swap_map_handle *handle,
}
}
}
}
}
}
swsusp_show_speed
(
&
start
,
&
stop
,
nr_to_read
,
"Read"
);
swsusp_show_speed
(
start
,
stop
,
nr_to_read
,
"Read"
);
out_clean:
out_clean:
for
(
i
=
0
;
i
<
ring_size
;
i
++
)
for
(
i
=
0
;
i
<
ring_size
;
i
++
)
free_page
((
unsigned
long
)
page
[
i
]);
free_page
((
unsigned
long
)
page
[
i
]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录