Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
6d80e53f
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看板
提交
6d80e53f
编写于
10月 06, 2008
作者:
A
Alexey Dobriyan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
proc: move pagecount stuff to fs/proc/page.c
Signed-off-by:
N
Alexey Dobriyan
<
adobriyan@gmail.com
>
上级
97ce5d6d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
148 addition
and
135 deletion
+148
-135
fs/proc/Makefile
fs/proc/Makefile
+1
-0
fs/proc/page.c
fs/proc/page.c
+147
-0
fs/proc/proc_misc.c
fs/proc/proc_misc.c
+0
-135
未找到文件。
fs/proc/Makefile
浏览文件 @
6d80e53f
...
...
@@ -24,3 +24,4 @@ proc-$(CONFIG_PROC_KCORE) += kcore.o
proc-$(CONFIG_PROC_VMCORE)
+=
vmcore.o
proc-$(CONFIG_PROC_DEVICETREE)
+=
proc_devtree.o
proc-$(CONFIG_PRINTK)
+=
kmsg.o
proc-$(CONFIG_PROC_PAGE_MONITOR)
+=
page.o
fs/proc/page.c
0 → 100644
浏览文件 @
6d80e53f
#include <linux/bootmem.h>
#include <linux/compiler.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/mmzone.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h>
#include "internal.h"
#define KPMSIZE sizeof(u64)
#define KPMMASK (KPMSIZE - 1)
/* /proc/kpagecount - an array exposing page counts
*
* Each entry is a u64 representing the corresponding
* physical page count.
*/
static
ssize_t
kpagecount_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
u64
__user
*
out
=
(
u64
__user
*
)
buf
;
struct
page
*
ppage
;
unsigned
long
src
=
*
ppos
;
unsigned
long
pfn
;
ssize_t
ret
=
0
;
u64
pcount
;
pfn
=
src
/
KPMSIZE
;
count
=
min_t
(
size_t
,
count
,
(
max_pfn
*
KPMSIZE
)
-
src
);
if
(
src
&
KPMMASK
||
count
&
KPMMASK
)
return
-
EINVAL
;
while
(
count
>
0
)
{
ppage
=
NULL
;
if
(
pfn_valid
(
pfn
))
ppage
=
pfn_to_page
(
pfn
);
pfn
++
;
if
(
!
ppage
)
pcount
=
0
;
else
pcount
=
page_mapcount
(
ppage
);
if
(
put_user
(
pcount
,
out
++
))
{
ret
=
-
EFAULT
;
break
;
}
count
-=
KPMSIZE
;
}
*
ppos
+=
(
char
__user
*
)
out
-
buf
;
if
(
!
ret
)
ret
=
(
char
__user
*
)
out
-
buf
;
return
ret
;
}
static
const
struct
file_operations
proc_kpagecount_operations
=
{
.
llseek
=
mem_lseek
,
.
read
=
kpagecount_read
,
};
/* /proc/kpageflags - an array exposing page flags
*
* Each entry is a u64 representing the corresponding
* physical page flags.
*/
/* These macros are used to decouple internal flags from exported ones */
#define KPF_LOCKED 0
#define KPF_ERROR 1
#define KPF_REFERENCED 2
#define KPF_UPTODATE 3
#define KPF_DIRTY 4
#define KPF_LRU 5
#define KPF_ACTIVE 6
#define KPF_SLAB 7
#define KPF_WRITEBACK 8
#define KPF_RECLAIM 9
#define KPF_BUDDY 10
#define kpf_copy_bit(flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos)
static
ssize_t
kpageflags_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
u64
__user
*
out
=
(
u64
__user
*
)
buf
;
struct
page
*
ppage
;
unsigned
long
src
=
*
ppos
;
unsigned
long
pfn
;
ssize_t
ret
=
0
;
u64
kflags
,
uflags
;
pfn
=
src
/
KPMSIZE
;
count
=
min_t
(
unsigned
long
,
count
,
(
max_pfn
*
KPMSIZE
)
-
src
);
if
(
src
&
KPMMASK
||
count
&
KPMMASK
)
return
-
EINVAL
;
while
(
count
>
0
)
{
ppage
=
NULL
;
if
(
pfn_valid
(
pfn
))
ppage
=
pfn_to_page
(
pfn
);
pfn
++
;
if
(
!
ppage
)
kflags
=
0
;
else
kflags
=
ppage
->
flags
;
uflags
=
kpf_copy_bit
(
KPF_LOCKED
,
PG_locked
,
kflags
)
|
kpf_copy_bit
(
kflags
,
KPF_ERROR
,
PG_error
)
|
kpf_copy_bit
(
kflags
,
KPF_REFERENCED
,
PG_referenced
)
|
kpf_copy_bit
(
kflags
,
KPF_UPTODATE
,
PG_uptodate
)
|
kpf_copy_bit
(
kflags
,
KPF_DIRTY
,
PG_dirty
)
|
kpf_copy_bit
(
kflags
,
KPF_LRU
,
PG_lru
)
|
kpf_copy_bit
(
kflags
,
KPF_ACTIVE
,
PG_active
)
|
kpf_copy_bit
(
kflags
,
KPF_SLAB
,
PG_slab
)
|
kpf_copy_bit
(
kflags
,
KPF_WRITEBACK
,
PG_writeback
)
|
kpf_copy_bit
(
kflags
,
KPF_RECLAIM
,
PG_reclaim
)
|
kpf_copy_bit
(
kflags
,
KPF_BUDDY
,
PG_buddy
);
if
(
put_user
(
uflags
,
out
++
))
{
ret
=
-
EFAULT
;
break
;
}
count
-=
KPMSIZE
;
}
*
ppos
+=
(
char
__user
*
)
out
-
buf
;
if
(
!
ret
)
ret
=
(
char
__user
*
)
out
-
buf
;
return
ret
;
}
static
const
struct
file_operations
proc_kpageflags_operations
=
{
.
llseek
=
mem_lseek
,
.
read
=
kpageflags_read
,
};
static
int
__init
proc_page_init
(
void
)
{
proc_create
(
"kpagecount"
,
S_IRUSR
,
NULL
,
&
proc_kpagecount_operations
);
proc_create
(
"kpageflags"
,
S_IRUSR
,
NULL
,
&
proc_kpageflags_operations
);
return
0
;
}
module_init
(
proc_page_init
);
fs/proc/proc_misc.c
浏览文件 @
6d80e53f
...
...
@@ -57,146 +57,11 @@
#include <asm/div64.h>
#include "internal.h"
#ifdef CONFIG_PROC_PAGE_MONITOR
#define KPMSIZE sizeof(u64)
#define KPMMASK (KPMSIZE - 1)
/* /proc/kpagecount - an array exposing page counts
*
* Each entry is a u64 representing the corresponding
* physical page count.
*/
static
ssize_t
kpagecount_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
u64
__user
*
out
=
(
u64
__user
*
)
buf
;
struct
page
*
ppage
;
unsigned
long
src
=
*
ppos
;
unsigned
long
pfn
;
ssize_t
ret
=
0
;
u64
pcount
;
pfn
=
src
/
KPMSIZE
;
count
=
min_t
(
size_t
,
count
,
(
max_pfn
*
KPMSIZE
)
-
src
);
if
(
src
&
KPMMASK
||
count
&
KPMMASK
)
return
-
EINVAL
;
while
(
count
>
0
)
{
ppage
=
NULL
;
if
(
pfn_valid
(
pfn
))
ppage
=
pfn_to_page
(
pfn
);
pfn
++
;
if
(
!
ppage
)
pcount
=
0
;
else
pcount
=
page_mapcount
(
ppage
);
if
(
put_user
(
pcount
,
out
++
))
{
ret
=
-
EFAULT
;
break
;
}
count
-=
KPMSIZE
;
}
*
ppos
+=
(
char
__user
*
)
out
-
buf
;
if
(
!
ret
)
ret
=
(
char
__user
*
)
out
-
buf
;
return
ret
;
}
static
struct
file_operations
proc_kpagecount_operations
=
{
.
llseek
=
mem_lseek
,
.
read
=
kpagecount_read
,
};
/* /proc/kpageflags - an array exposing page flags
*
* Each entry is a u64 representing the corresponding
* physical page flags.
*/
/* These macros are used to decouple internal flags from exported ones */
#define KPF_LOCKED 0
#define KPF_ERROR 1
#define KPF_REFERENCED 2
#define KPF_UPTODATE 3
#define KPF_DIRTY 4
#define KPF_LRU 5
#define KPF_ACTIVE 6
#define KPF_SLAB 7
#define KPF_WRITEBACK 8
#define KPF_RECLAIM 9
#define KPF_BUDDY 10
#define kpf_copy_bit(flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos)
static
ssize_t
kpageflags_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
u64
__user
*
out
=
(
u64
__user
*
)
buf
;
struct
page
*
ppage
;
unsigned
long
src
=
*
ppos
;
unsigned
long
pfn
;
ssize_t
ret
=
0
;
u64
kflags
,
uflags
;
pfn
=
src
/
KPMSIZE
;
count
=
min_t
(
unsigned
long
,
count
,
(
max_pfn
*
KPMSIZE
)
-
src
);
if
(
src
&
KPMMASK
||
count
&
KPMMASK
)
return
-
EINVAL
;
while
(
count
>
0
)
{
ppage
=
NULL
;
if
(
pfn_valid
(
pfn
))
ppage
=
pfn_to_page
(
pfn
);
pfn
++
;
if
(
!
ppage
)
kflags
=
0
;
else
kflags
=
ppage
->
flags
;
uflags
=
kpf_copy_bit
(
KPF_LOCKED
,
PG_locked
,
kflags
)
|
kpf_copy_bit
(
kflags
,
KPF_ERROR
,
PG_error
)
|
kpf_copy_bit
(
kflags
,
KPF_REFERENCED
,
PG_referenced
)
|
kpf_copy_bit
(
kflags
,
KPF_UPTODATE
,
PG_uptodate
)
|
kpf_copy_bit
(
kflags
,
KPF_DIRTY
,
PG_dirty
)
|
kpf_copy_bit
(
kflags
,
KPF_LRU
,
PG_lru
)
|
kpf_copy_bit
(
kflags
,
KPF_ACTIVE
,
PG_active
)
|
kpf_copy_bit
(
kflags
,
KPF_SLAB
,
PG_slab
)
|
kpf_copy_bit
(
kflags
,
KPF_WRITEBACK
,
PG_writeback
)
|
kpf_copy_bit
(
kflags
,
KPF_RECLAIM
,
PG_reclaim
)
|
kpf_copy_bit
(
kflags
,
KPF_BUDDY
,
PG_buddy
);
if
(
put_user
(
uflags
,
out
++
))
{
ret
=
-
EFAULT
;
break
;
}
count
-=
KPMSIZE
;
}
*
ppos
+=
(
char
__user
*
)
out
-
buf
;
if
(
!
ret
)
ret
=
(
char
__user
*
)
out
-
buf
;
return
ret
;
}
static
struct
file_operations
proc_kpageflags_operations
=
{
.
llseek
=
mem_lseek
,
.
read
=
kpageflags_read
,
};
#endif
/* CONFIG_PROC_PAGE_MONITOR */
void
__init
proc_misc_init
(
void
)
{
proc_symlink
(
"mounts"
,
NULL
,
"self/mounts"
);
/* And now for trickier ones */
#ifdef CONFIG_PROC_PAGE_MONITOR
proc_create
(
"kpagecount"
,
S_IRUSR
,
NULL
,
&
proc_kpagecount_operations
);
proc_create
(
"kpageflags"
,
S_IRUSR
,
NULL
,
&
proc_kpageflags_operations
);
#endif
#ifdef CONFIG_PROC_VMCORE
proc_vmcore
=
proc_create
(
"vmcore"
,
S_IRUSR
,
NULL
,
&
proc_vmcore_operations
);
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录