Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
8a620c2e
提交
8a620c2e
11月 14, 2011
创建
作者:
Silas Boyd-Wickizer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wq tweak: __wq_run now inherits the frame of the thread it's running.
上级
e6668071
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
15 行增加
和
7 行删除
+15
-7
cpu.h
cpu.h
+3
-1
param.h
param.h
+1
-1
wq.c
wq.c
+11
-5
没有找到文件。
cpu.h
浏览文件 @
8a620c2e
#include "mmu.h"
struct
wqframe
;
// Per-CPU state
struct
cpu
{
u8
id
;
// Local APIC ID; index into cpus[] below
int
ncli
;
// Depth of pushcli nesting.
int
intena
;
// Were interrupts enabled before pushcli?
...
...
@@ -10,6 +11,7 @@ struct cpu {
struct
taskstate
ts
;
// Used by x86 to find stack for interrupt
struct
context
*
scheduler
;
// swtch() here to enter scheduler
u64
last_rcu_gc_ticks
;
struct
wqframe
*
wqframe
;
// Cpu-local storage variables; see below
struct
cpu
*
cpu
;
...
...
param.h
浏览文件 @
8a620c2e
...
...
@@ -18,4 +18,4 @@
#define CPUKSTACKS (NPROC + NCPU)
#define QUANTUN 10 // scheduling time quantum and tick length (in msec)
#define WQSHIFT 4 // 2^WORKSHIFT work queue slots
#define WQENABLE
0
// Enable work queue
#define WQENABLE
1
// Enable work queue
wq.c
浏览文件 @
8a620c2e
...
...
@@ -51,7 +51,7 @@ struct wqthread {
u64
rip
;
u64
arg0
;
u64
arg1
;
volatile
u64
*
ref
;
// pointer to parent wqframe.ref
struct
wqframe
*
frame
;
// parent wqframe
__padout__
;
}
__mpalign__
;
...
...
@@ -75,7 +75,7 @@ wq_cur(void)
static
struct
wqframe
*
wq_frame
(
void
)
{
return
&
myproc
()
->
wqframe
;
return
mycpu
()
->
wqframe
;
}
static
struct
wqstat
*
...
...
@@ -144,8 +144,12 @@ static void
__wq_run
(
struct
wqthread
*
th
)
{
void
(
*
fn
)(
uptr
arg0
,
uptr
arg1
)
=
(
void
*
)
th
->
rip
;
struct
wqframe
*
old
=
mycpu
()
->
wqframe
;
mycpu
()
->
wqframe
=
th
->
frame
;
fn
(
th
->
arg0
,
th
->
arg1
);
subfetch
(
th
->
ref
,
1
);
mycpu
()
->
wqframe
=
old
;
subfetch
(
&
th
->
frame
->
ref
,
1
);
kfree
(
th
);
}
...
...
@@ -166,7 +170,7 @@ wq_push(void *rip, u64 arg0, u64 arg1)
th
->
rip
=
(
uptr
)
rip
;
th
->
arg0
=
arg0
;
th
->
arg1
=
arg1
;
th
->
ref
=
&
wq_frame
()
->
ref
;
th
->
frame
=
wq_frame
()
;
if
(
__wq_push
(
wq_cur
(),
th
))
{
kfree
(
th
);
...
...
@@ -216,6 +220,7 @@ wq_start(void)
pushcli
();
if
(
myproc
()
->
wqframe
.
ref
!=
0
)
panic
(
"wq_start"
);
mycpu
()
->
wqframe
=
&
myproc
()
->
wqframe
;
}
// End of the current work queue frame.
...
...
@@ -224,7 +229,7 @@ wq_start(void)
void
wq_end
(
void
)
{
while
(
myproc
()
->
wqframe
.
ref
!=
0
)
{
while
(
wq_frame
()
->
ref
!=
0
)
{
struct
wqthread
*
th
;
int
i
;
...
...
@@ -239,6 +244,7 @@ wq_end(void)
}
}
}
mycpu
()
->
wqframe
=
NULL
;
popcli
();
}
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论