Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
15145902
提交
15145902
4月 01, 2012
创建
作者:
Nickolai Zeldovich
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'scale-amd64' of
git+ssh://pdos.csail.mit.edu/home/am0/6.828/xv6
into scale-amd64
上级
2ceeaa4f
a47f4a3f
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
56 行增加
和
57 行删除
+56
-57
wq.hh
include/wq.hh
+5
-2
exec.cc
kernel/exec.cc
+1
-1
kalloc.cc
kernel/kalloc.cc
+1
-21
kmalloc.cc
kernel/kmalloc.cc
+0
-1
proc.cc
kernel/proc.cc
+1
-1
uwq.cc
kernel/uwq.cc
+3
-1
wqkern.cc
kernel/wqkern.cc
+7
-3
wqalloc.cc
lib/wqalloc.cc
+7
-0
wqlib.cc
lib/wqlib.cc
+4
-6
wquser.cc
lib/wquser.cc
+4
-0
param.h
param.h
+23
-21
没有找到文件。
include/wq.hh
浏览文件 @
15145902
...
...
@@ -8,7 +8,6 @@ class work;
int
wq_trywork
(
void
);
int
wq_push
(
work
*
w
);
int
wq_pushto
(
work
*
w
,
int
tcpuid
);
void
wq_dump
(
void
);
size_t
wq_size
(
void
);
void
initwq
(
void
);
...
...
@@ -48,7 +47,7 @@ class wq {
public
:
wq
();
int
push
(
work
*
w
,
int
tcpuid
);
int
trywork
();
int
trywork
(
bool
steal
=
true
);
void
dump
();
static
void
*
operator
new
(
unsigned
long
);
...
...
@@ -85,6 +84,10 @@ private:
void
*
xallocwork
(
unsigned
long
nbytes
);
void
xfreework
(
void
*
ptr
,
unsigned
long
nbytes
);
#if defined(XV6_KERNEL)
int
wqcrit_push
(
work
*
w
,
int
c
);
#endif
#if defined(XV6_USER)
void
*
wqalloc
(
unsigned
long
nbytes
);
void
wqfree
(
void
*
ptr
);
...
...
kernel/exec.cc
浏览文件 @
15145902
...
...
@@ -248,7 +248,7 @@ exec(const char *path, char **argv, void *ascopev)
w
->
rip
=
(
void
*
)
exec_cleanup
;
w
->
arg0
=
oldvmap
;
w
->
arg1
=
olduwq
;
assert
(
wq
_pushto
(
w
,
myproc
()
->
exec_cpuid_
)
>=
0
);
assert
(
wq
crit_push
(
w
,
myproc
()
->
exec_cpuid_
)
>=
0
);
gc_end_epoch
();
return
0
;
...
...
kernel/kalloc.cc
浏览文件 @
15145902
...
...
@@ -287,7 +287,7 @@ initkalloc(u64 mbaddr)
strncpy
(
slabmem
[
slab_wq
][
c
].
name
,
" wq"
,
MAXNAME
);
slabmem
[
slab_wq
][
c
].
size
=
PGROUNDUP
(
wq_size
());
slabmem
[
slab_wq
][
c
].
ninit
=
NCPU
;
slabmem
[
slab_wq
][
c
].
ninit
=
2
;
strncpy
(
slabmem
[
slab_userwq
][
c
].
name
,
" uwq"
,
MAXNAME
);
slabmem
[
slab_userwq
][
c
].
size
=
USERWQSIZE
;
...
...
@@ -315,7 +315,6 @@ initkalloc(u64 mbaddr)
void
kfree
(
void
*
v
)
{
verifyfree
((
char
*
)
v
,
mykmem
()
->
size
);
kfree_pool
(
mykmem
(),
(
char
*
)
v
);
}
...
...
@@ -324,22 +323,3 @@ ksfree(int slab, void *v)
{
kfree_pool
(
slabmem
[
slab
],
(
char
*
)
v
);
}
void
verifyfree
(
char
*
ptr
,
u64
nbytes
)
{
#if VERIFYFREE
char
*
p
=
ptr
;
char
*
e
=
p
+
nbytes
;
for
(;
p
<
e
;
p
++
)
{
// Search for pointers in the ptr region
u64
x
=
*
(
uptr
*
)
p
;
if
((
KBASE
<
x
&&
x
<
KBASE
+
(
128ull
<<
30
))
||
(
KCODE
<
x
))
{
struct
klockstat
*
kls
=
(
struct
klockstat
*
)
x
;
if
(
kls
->
magic
==
LOCKSTAT_MAGIC
)
panic
(
"LOCKSTAT_MAGIC %p(%lu):%p->%p"
,
ptr
,
nbytes
,
p
,
kls
);
}
}
#endif
}
kernel/kmalloc.cc
浏览文件 @
15145902
...
...
@@ -117,7 +117,6 @@ kmfree(void *ap, u64 nbytes)
int
b
=
bucket
(
nbytes
);
struct
header
*
h
=
(
struct
header
*
)
ap
;
verifyfree
((
char
*
)
ap
,
(
1
<<
b
));
if
(
ALLOC_MEMSET
)
memset
(
ap
,
3
,
(
1
<<
b
));
...
...
kernel/proc.cc
浏览文件 @
15145902
...
...
@@ -443,7 +443,7 @@ wait(void)
assert
(
w
);
w
->
rip
=
(
void
*
)
finishproc
;
w
->
arg0
=
p
;
assert
(
wq
_pushto
(
w
,
p
->
run_cpuid_
)
>=
0
);
assert
(
wq
crit_push
(
w
,
p
->
run_cpuid_
)
>=
0
);
if
(
!
xnspid
->
remove
(
pid
,
&
p
))
panic
(
"wait: ns_remove"
);
...
...
kernel/uwq.cc
浏览文件 @
15145902
...
...
@@ -142,7 +142,9 @@ uwq::uwq(vmap* vmap, filetable* ftable, uwq_ipcbuf* ipc)
ipc_
->
len
[
i
].
v_
=
0
;
initlock
(
&
lock_
,
"uwq_lock"
,
0
);
memset
(
worker_
,
0
,
sizeof
(
worker_
));
for
(
int
i
=
0
;
i
<
NWORKERS
;
i
++
)
worker_
[
i
].
store
(
nullptr
);
}
uwq
::~
uwq
(
void
)
...
...
kernel/wqkern.cc
浏览文件 @
15145902
...
...
@@ -7,6 +7,7 @@
#include "wq.hh"
static
wq
*
wq_
;
static
wq
*
wqcrit_
;
void
*
xallocwork
(
unsigned
long
nbytes
)
...
...
@@ -33,15 +34,15 @@ wq_push(work *w)
}
int
wq
_pushto
(
work
*
w
,
int
tcpuid
)
wq
crit_push
(
work
*
w
,
int
c
)
{
return
wq
_
->
push
(
w
,
tcpuid
);
return
wq
crit_
->
push
(
w
,
c
);
}
int
wq_trywork
(
void
)
{
return
wq
_
->
trywork
(
);
return
wq
crit_
->
trywork
(
false
)
||
wq_
->
trywork
(
true
);
}
void
...
...
@@ -54,4 +55,7 @@ void
initwq
(
void
)
{
wq_
=
new
wq
();
wqcrit_
=
new
wq
();
if
(
wq_
==
nullptr
||
wqcrit_
==
nullptr
)
panic
(
"initwq"
);
}
lib/wqalloc.cc
浏览文件 @
15145902
...
...
@@ -50,3 +50,10 @@ wqfree(void *ptr)
b
->
next
=
*
block
;
*
block
=
b
;
}
void
wqallocinit
(
void
)
{
for
(
int
i
=
0
;
i
<
NCPU
;
i
++
)
block
[
i
]
=
nullptr
;
}
lib/wqlib.cc
浏览文件 @
15145902
...
...
@@ -7,8 +7,6 @@
#endif
#include "wq.hh"
enum
{
wq_steal_others
=
1
};
//
// wq
//
...
...
@@ -118,9 +116,6 @@ wq::pop(int c)
inline
work
*
wq
::
steal
(
int
c
)
{
if
(
!
wq_steal_others
&&
(
c
!=
mycpuid
()))
return
0
;
struct
wqueue
*
q
=
&
q_
[
c
];
work
*
w
;
int
i
;
...
...
@@ -143,7 +138,7 @@ wq::steal(int c)
}
int
wq
::
trywork
(
void
)
wq
::
trywork
(
bool
dosteal
)
{
work
*
w
;
u64
i
,
k
;
...
...
@@ -157,6 +152,9 @@ wq::trywork(void)
return
1
;
}
if
(
!
dosteal
)
return
0
;
for
(
i
=
0
;
i
<
NCPU
;
i
++
)
{
u64
j
=
(
i
+
k
)
%
NCPU
;
...
...
lib/wquser.cc
浏览文件 @
15145902
...
...
@@ -83,12 +83,16 @@ xfreework(void* ptr, unsigned long nbytes)
void
initwq
(
void
)
{
extern
void
wqallocinit
(
void
);
if
(
pthread_key_create
(
&
idkey
,
0
))
die
(
"wqarch_init: pthread_key_create"
);
int
id
=
nextid
++
;
pthread_setspecific
(
idkey
,
(
void
*
)(
u64
)
id
);
wqallocinit
();
wq_
=
new
wq
();
if
(
wq_
==
nullptr
)
die
(
"initwq"
);
...
...
param.h
浏览文件 @
15145902
#pragma once
#define DEBUG 0
#define NPROC 64 // maximum number of processes
#define KSTACKSIZE 8192 // size of per-process kernel stack
#define NOFILE 64 // open files per process
...
...
@@ -14,13 +13,11 @@
#define CACHELINE 64 // cache line size
#define CPUKSTACKS (NPROC + NCPU*2)
#define QUANTUM 10 // scheduling time quantum and tick length (in msec)
#define CILKSHIFT 4 // 2^WORKSHIFT work queue slots
#define VICTIMAGE 1000000 // cycles a proc executes before an eligible victim
#define VERBOSE 0 // print kernel diagnostics
#define SPINLOCK_DEBUG DEBUG // Debug spin locks
#define RCU_TYPE_DEBUG DEBUG
#define LOCKSTAT DEBUG
#define VERIFYFREE 0 // Unreliable, e.g. vma's vmnode pointer gets reused
#define ALLOC_MEMSET DEBUG
#define KSHAREDSIZE (32 << 10)
#define USERWQSIZE (1 << 14)
...
...
@@ -28,29 +25,34 @@
#define WQSHIFT 7
#define CILKENABLE 0
#if defined(HW_qemu)
#define NCPU 8 // maximum number of CPUs
#define MTRACE 0
#define PERFSIZE (16<<20ull)
#define NCPU
8 // maximum number of CPUs
#define MTRACE
0
#define PERFSIZE
(16<<20ull)
#elif defined(HW_josmp)
#define NCPU 16 // maximum number of CPUs
#define MTRACE 0
#define PERFSIZE (1<<20ull)
#define DEBUG 0
#define NCPU 16 // maximum number of CPUs
#define MTRACE 0
#define PERFSIZE (1<<20ull)
#elif defined(HW_ud0)
#define NCPU 4 // maximum number of CPUs
#define MTRACE 0
#define PERFSIZE (512<<20ull)
#define NCPU
4 // maximum number of CPUs
#define MTRACE
0
#define PERFSIZE
(512<<20ull)
#elif defined(HW_tom)
#define NCPU 48 // maximum number of CPUs
#define MTRACE 0
#define PERFSIZE (1<<20ull)
#define NCPU
48 // maximum number of CPUs
#define MTRACE
0
#define PERFSIZE
(1<<20ull)
#elif defined(HW_user)
#define NCPU 256
#define MTRACE 0
#define PERFSIZE (16<<20ull)
#define NCPU
256
#define MTRACE
0
#define PERFSIZE
(16<<20ull)
#elif defined(HW_wq)
#define NCPU 2
#define MTRACE 0
#define PERFSIZE (16<<20ull)
#define NCPU
2
#define MTRACE
0
#define PERFSIZE
(16<<20ull)
#else
#error "Unknown HW"
#endif
#ifndef DEBUG
#define DEBUG 1
#endif
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论