Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
ac3e3c5b
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看板
提交
ac3e3c5b
编写于
4月 28, 2013
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
don't bother with deferred freeing of fdtables
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
094dd33b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
2 addition
and
67 deletion
+2
-67
fs/file.c
fs/file.c
+2
-66
include/linux/fdtable.h
include/linux/fdtable.h
+0
-1
未找到文件。
fs/file.c
浏览文件 @
ac3e3c5b
...
...
@@ -23,24 +23,10 @@
#include <linux/rcupdate.h>
#include <linux/workqueue.h>
struct
fdtable_defer
{
spinlock_t
lock
;
struct
work_struct
wq
;
struct
fdtable
*
next
;
};
int
sysctl_nr_open
__read_mostly
=
1024
*
1024
;
int
sysctl_nr_open_min
=
BITS_PER_LONG
;
int
sysctl_nr_open_max
=
1024
*
1024
;
/* raised later */
/*
* We use this list to defer free fdtables that have vmalloced
* sets/arrays. By keeping a per-cpu list, we avoid having to embed
* the work_struct in fdtable itself which avoids a 64 byte (i386) increase in
* this per-task structure.
*/
static
DEFINE_PER_CPU
(
struct
fdtable_defer
,
fdtable_defer_list
);
static
void
*
alloc_fdmem
(
size_t
size
)
{
/*
...
...
@@ -67,46 +53,9 @@ static void __free_fdtable(struct fdtable *fdt)
kfree
(
fdt
);
}
static
void
free_fdtable_work
(
struct
work_struct
*
work
)
{
struct
fdtable_defer
*
f
=
container_of
(
work
,
struct
fdtable_defer
,
wq
);
struct
fdtable
*
fdt
;
spin_lock_bh
(
&
f
->
lock
);
fdt
=
f
->
next
;
f
->
next
=
NULL
;
spin_unlock_bh
(
&
f
->
lock
);
while
(
fdt
)
{
struct
fdtable
*
next
=
fdt
->
next
;
__free_fdtable
(
fdt
);
fdt
=
next
;
}
}
static
void
free_fdtable_rcu
(
struct
rcu_head
*
rcu
)
{
struct
fdtable
*
fdt
=
container_of
(
rcu
,
struct
fdtable
,
rcu
);
struct
fdtable_defer
*
fddef
;
BUG_ON
(
!
fdt
);
BUG_ON
(
fdt
->
max_fds
<=
NR_OPEN_DEFAULT
);
if
(
!
is_vmalloc_addr
(
fdt
->
fd
)
&&
!
is_vmalloc_addr
(
fdt
->
open_fds
))
{
kfree
(
fdt
->
fd
);
kfree
(
fdt
->
open_fds
);
kfree
(
fdt
);
}
else
{
fddef
=
&
get_cpu_var
(
fdtable_defer_list
);
spin_lock
(
&
fddef
->
lock
);
fdt
->
next
=
fddef
->
next
;
fddef
->
next
=
fdt
;
/* vmallocs are handled from the workqueue context */
schedule_work
(
&
fddef
->
wq
);
spin_unlock
(
&
fddef
->
lock
);
put_cpu_var
(
fdtable_defer_list
);
}
__free_fdtable
(
container_of
(
rcu
,
struct
fdtable
,
rcu
));
}
/*
...
...
@@ -174,7 +123,6 @@ static struct fdtable * alloc_fdtable(unsigned int nr)
fdt
->
open_fds
=
data
;
data
+=
nr
/
BITS_PER_BYTE
;
fdt
->
close_on_exec
=
data
;
fdt
->
next
=
NULL
;
return
fdt
;
...
...
@@ -221,7 +169,7 @@ static int expand_fdtable(struct files_struct *files, int nr)
/* Continue as planned */
copy_fdtable
(
new_fdt
,
cur_fdt
);
rcu_assign_pointer
(
files
->
fdt
,
new_fdt
);
if
(
cur_fdt
->
max_fds
>
NR_OPEN_DEFAULT
)
if
(
cur_fdt
!=
&
files
->
fdtab
)
call_rcu
(
&
cur_fdt
->
rcu
,
free_fdtable_rcu
);
}
else
{
/* Somebody else expanded, so undo our attempt */
...
...
@@ -316,7 +264,6 @@ struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
new_fdt
->
close_on_exec
=
newf
->
close_on_exec_init
;
new_fdt
->
open_fds
=
newf
->
open_fds_init
;
new_fdt
->
fd
=
&
newf
->
fd_array
[
0
];
new_fdt
->
next
=
NULL
;
spin_lock
(
&
oldf
->
file_lock
);
old_fdt
=
files_fdtable
(
oldf
);
...
...
@@ -490,19 +437,8 @@ void exit_files(struct task_struct *tsk)
}
}
static
void
fdtable_defer_list_init
(
int
cpu
)
{
struct
fdtable_defer
*
fddef
=
&
per_cpu
(
fdtable_defer_list
,
cpu
);
spin_lock_init
(
&
fddef
->
lock
);
INIT_WORK
(
&
fddef
->
wq
,
free_fdtable_work
);
fddef
->
next
=
NULL
;
}
void
__init
files_defer_init
(
void
)
{
int
i
;
for_each_possible_cpu
(
i
)
fdtable_defer_list_init
(
i
);
sysctl_nr_open_max
=
min
((
size_t
)
INT_MAX
,
~
(
size_t
)
0
/
sizeof
(
void
*
))
&
-
BITS_PER_LONG
;
}
...
...
include/linux/fdtable.h
浏览文件 @
ac3e3c5b
...
...
@@ -27,7 +27,6 @@ struct fdtable {
unsigned
long
*
close_on_exec
;
unsigned
long
*
open_fds
;
struct
rcu_head
rcu
;
struct
fdtable
*
next
;
};
static
inline
bool
close_on_exec
(
int
fd
,
const
struct
fdtable
*
fdt
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录