Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
SWIFT
SWIFTsim
Commits
938c10b6
Commit
938c10b6
authored
11 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
try several steals after a failed get attempt on the preferred queue.
Former-commit-id: d0abb3e20eb09afe730495ce622866b8b8cf3fc2
parent
3babf1ea
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/scheduler.c
+9
-2
9 additions, 2 deletions
src/scheduler.c
src/scheduler.h
+2
-1
2 additions, 1 deletion
src/scheduler.h
with
11 additions
and
3 deletions
src/scheduler.c
+
9
−
2
View file @
938c10b6
...
...
@@ -847,7 +847,7 @@ struct task *scheduler_gettask ( struct scheduler *s , int qid , struct cell *su
while
(
s
->
waiting
>
0
&&
res
==
NULL
)
{
/* Try more than once before sleeping. */
for
(
int
tries
=
0
;
res
==
NULL
&&
tries
<
scheduler_
flag_maxsteal
;
tries
++
)
{
for
(
int
tries
=
0
;
res
==
NULL
&&
tries
<
scheduler_
maxtries
;
tries
++
)
{
/* Try to get a task from the suggested queue. */
if
(
(
res
=
queue_gettask
(
&
s
->
queues
[
qid
]
,
qid
,
super
,
0
)
)
!=
NULL
)
...
...
@@ -859,7 +859,14 @@ struct task *scheduler_gettask ( struct scheduler *s , int qid , struct cell *su
for
(
k
=
0
;
k
<
nr_queues
;
k
++
)
if
(
s
->
queues
[
k
].
count
>
0
)
qids
[
count
++
]
=
k
;
if
(
count
>
0
&&
(
res
=
queue_gettask
(
&
s
->
queues
[
qids
[
rand
()
%
count
]
]
,
qid
,
super
,
0
)
)
!=
NULL
)
for
(
k
=
0
;
k
<
scheduler_maxsteal
&&
count
>
0
;
k
++
)
{
int
ind
=
rand
()
%
count
;
if
(
(
res
=
queue_gettask
(
&
s
->
queues
[
qids
[
ind
]
]
,
qid
,
super
,
0
)
)
!=
NULL
)
break
;
else
qids
[
ind
]
=
qids
[
--
count
];
}
if
(
res
!=
NULL
)
break
;
}
...
...
This diff is collapsed.
Click to expand it.
src/scheduler.h
+
2
−
1
View file @
938c10b6
...
...
@@ -22,11 +22,12 @@
#define scheduler_maxwait 3
#define scheduler_maxunlock 40
#define scheduler_dosub 1
#define scheduler_maxsteal 10
#define scheduler_maxtries 10
/* Flags . */
#define scheduler_flag_none 0
#define scheduler_flag_steal 1
#define scheduler_flag_maxsteal 10
/* Data of a scheduler. */
...
...
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