Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xv6-19au
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
csep551
xv6-19au
Commits
11b7438b
Commit
11b7438b
authored
13 years ago
by
Frans Kaashoek
Browse files
Options
Downloads
Patches
Plain Diff
Speedup sbrk tst a bit (forking 100Mbyte processes is slow)
parent
64797663
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
usertests.c
+10
-4
10 additions, 4 deletions
usertests.c
with
10 additions
and
4 deletions
usertests.c
+
10
−
4
View file @
11b7438b
...
...
@@ -1238,7 +1238,7 @@ forktest(void)
void
sbrktest
(
void
)
{
int
fds
[
2
],
pid
,
pids
[
32
],
ppid
;
int
fds
[
2
],
pid
,
pids
[
10
],
ppid
;
char
*
a
,
*
b
,
*
c
,
*
lastaddr
,
*
oldbrk
,
*
p
,
scratch
;
uint
amt
;
...
...
@@ -1310,6 +1310,13 @@ sbrktest(void)
exit
();
}
a
=
sbrk
(
0
);
c
=
sbrk
(
-
(
sbrk
(
0
)
-
oldbrk
));
if
(
c
!=
a
){
printf
(
stdout
,
"sbrk downsize failed, a %x c %x
\n
"
,
a
,
c
);
exit
();
}
// can we read the kernel's memory?
for
(
a
=
(
char
*
)(
KERNBASE
);
a
<
(
char
*
)
(
KERNBASE
+
2000000
);
a
+=
50000
){
ppid
=
getpid
();
...
...
@@ -1328,15 +1335,14 @@ sbrktest(void)
// if we run the system out of memory, does it clean up the last
// failed allocation?
sbrk
(
-
(
sbrk
(
0
)
-
oldbrk
));
if
(
pipe
(
fds
)
!=
0
){
printf
(
1
,
"pipe() failed
\n
"
);
exit
();
}
for
(
i
=
0
;
i
<
sizeof
(
pids
)
/
sizeof
(
pids
[
0
]);
i
++
){
if
((
pids
[
i
]
=
fork
())
==
0
){
// allocate
the full 640K
sbrk
(
(
640
*
1024
)
-
(
uint
)
sbrk
(
0
));
// allocate
a lot of memory
sbrk
(
BIG
-
(
uint
)
sbrk
(
0
));
write
(
fds
[
1
],
"x"
,
1
);
// sit around until killed
for
(;;)
sleep
(
1000
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment