Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
KOS
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
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
Martin Karsten
KOS
Commits
7165e0db
Commit
7165e0db
authored
6 years ago
by
Martin Karsten
Browse files
Options
Downloads
Patches
Plain Diff
- separate out busyLock from Cluster's idleLock
parent
6945e1a5
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/kernel/KernelProcessor.cc
+1
-1
1 addition, 1 deletion
src/kernel/KernelProcessor.cc
src/libfibre/SystemProcessor.cc
+1
-1
1 addition, 1 deletion
src/libfibre/SystemProcessor.cc
src/runtime/Cluster.h
+13
-8
13 additions, 8 deletions
src/runtime/Cluster.h
with
15 additions
and
10 deletions
src/kernel/KernelProcessor.cc
+
1
−
1
View file @
7165e0db
...
@@ -43,8 +43,8 @@ inline void KernelProcessor::idleLoop(bool irqs) {
...
@@ -43,8 +43,8 @@ inline void KernelProcessor::idleLoop(bool irqs) {
if
(
cluster
.
setProcessorIdle
(
*
this
,
terminate
))
{
if
(
cluster
.
setProcessorIdle
(
*
this
,
terminate
))
{
stats
->
idle
.
count
();
stats
->
idle
.
count
();
if
(
!
CurrFM
().
zeroMemory
<
smallpl
>
())
halt
(
!
irqs
);
if
(
!
CurrFM
().
zeroMemory
<
smallpl
>
())
halt
(
!
irqs
);
cluster
.
setProcessorBusy
(
*
this
);
}
}
cluster
.
setProcessorBusy
(
*
this
);
}
}
unreachable
();
unreachable
();
}
}
...
...
This diff is collapsed.
Click to expand it.
src/libfibre/SystemProcessor.cc
+
1
−
1
View file @
7165e0db
...
@@ -101,8 +101,8 @@ inline void SystemProcessor::idleLoop() {
...
@@ -101,8 +101,8 @@ inline void SystemProcessor::idleLoop() {
if
(
reinterpret_cast
<
FibreCluster
&>
(
cluster
).
setProcessorIdle
(
*
this
,
terminate
))
{
if
(
reinterpret_cast
<
FibreCluster
&>
(
cluster
).
setProcessorIdle
(
*
this
,
terminate
))
{
stats
->
idle
.
count
();
stats
->
idle
.
count
();
idleSem
.
P
();
idleSem
.
P
();
cluster
.
setProcessorBusy
(
*
this
);
}
}
cluster
.
setProcessorBusy
(
*
this
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/runtime/Cluster.h
+
13
−
8
View file @
7165e0db
...
@@ -33,6 +33,7 @@ protected:
...
@@ -33,6 +33,7 @@ protected:
SystemLock
idleLock
;
SystemLock
idleLock
;
ProcessorList
idleList
;
ProcessorList
idleList
;
volatile
size_t
idleCount
;
volatile
size_t
idleCount
;
SystemLock
busyLock
;
ProcessorList
busyList
;
ProcessorList
busyList
;
public:
public:
...
@@ -54,7 +55,7 @@ public:
...
@@ -54,7 +55,7 @@ public:
ProcessorRing
::
insert_after
(
*
ringProc
,
proc
);
ProcessorRing
::
insert_after
(
*
ringProc
,
proc
);
}
}
#endif
#endif
ScopedLock
<
SystemLock
>
sli
(
idle
Lock
);
ScopedLock
<
SystemLock
>
sli
(
busy
Lock
);
busyList
.
push_back
(
proc
);
busyList
.
push_back
(
proc
);
pCount
+=
1
;
pCount
+=
1
;
}
}
...
@@ -69,7 +70,7 @@ public:
...
@@ -69,7 +70,7 @@ public:
if
(
ringProc
==
&
proc
)
ringProc
=
nullptr
;
if
(
ringProc
==
&
proc
)
ringProc
=
nullptr
;
ProcessorRing
::
remove
(
proc
);
ProcessorRing
::
remove
(
proc
);
#endif
#endif
ScopedLock
<
SystemLock
>
sli
(
idle
Lock
);
ScopedLock
<
SystemLock
>
sli
(
busy
Lock
);
busyList
.
remove
(
proc
);
busyList
.
remove
(
proc
);
pCount
-=
1
;
pCount
-=
1
;
}
}
...
@@ -92,7 +93,7 @@ public:
...
@@ -92,7 +93,7 @@ public:
}
}
StackContext
*
steal
()
{
StackContext
*
steal
()
{
ScopedLock
<
SystemLock
>
sl
(
idle
Lock
);
ScopedLock
<
SystemLock
>
sl
(
busy
Lock
);
BaseProcessor
*
p
=
busyList
.
front
();
BaseProcessor
*
p
=
busyList
.
front
();
while
(
p
!=
busyList
.
edge
())
{
while
(
p
!=
busyList
.
edge
())
{
StackContext
*
s
=
p
->
dequeue
<
true
>
(
_friend
<
Cluster
>
());
StackContext
*
s
=
p
->
dequeue
<
true
>
(
_friend
<
Cluster
>
());
...
@@ -107,21 +108,25 @@ public:
...
@@ -107,21 +108,25 @@ public:
}
}
size_t
setProcessorIdle
(
BaseProcessor
&
proc
,
bool
terminating
)
{
size_t
setProcessorIdle
(
BaseProcessor
&
proc
,
bool
terminating
)
{
ScopedLock
<
SystemLock
>
sl
(
idleLock
);
busyLock
.
acquire
();
if
(
!
terminating
&&
(
backgroundProc
.
load
()
||
stagingProc
.
load
()))
return
0
;
busyList
.
remove
(
proc
);
busyList
.
remove
(
proc
);
busyLock
.
release
();
Runtime
::
debugS
(
"Processor "
,
FmtHex
(
&
proc
),
" on idle list"
);
ScopedLock
<
SystemLock
>
sl
(
idleLock
);
idleList
.
push_back
(
proc
);
idleList
.
push_back
(
proc
);
idleCount
+=
1
;
idleCount
+=
1
;
Runtime
::
debugS
(
"Processor "
,
FmtHex
(
&
proc
),
" on idle list"
)
;
if
(
!
terminating
&&
(
backgroundProc
.
load
()
||
stagingProc
.
load
()))
return
0
;
return
idleCount
;
return
idleCount
;
}
}
void
setProcessorBusy
(
BaseProcessor
&
proc
)
{
void
setProcessorBusy
(
BaseProcessor
&
proc
)
{
ScopedLock
<
SystemLock
>
sl
(
idleLock
);
idleLock
.
acquire
(
);
idleCount
-=
1
;
idleCount
-=
1
;
idleList
.
remove
(
proc
);
idleList
.
remove
(
proc
);
busyList
.
push_back
(
proc
);
idleLock
.
release
(
);
Runtime
::
debugS
(
"Processor "
,
FmtHex
(
&
proc
),
" off idle list"
);
Runtime
::
debugS
(
"Processor "
,
FmtHex
(
&
proc
),
" off idle list"
);
ScopedLock
<
SystemLock
>
sl
(
busyLock
);
busyList
.
push_back
(
proc
);
}
}
BaseProcessor
*
findIdleProcessorHard
()
{
BaseProcessor
*
findIdleProcessorHard
()
{
...
...
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