Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
8add570a
Commit
8add570a
authored
Oct 23, 2009
by
Tony Luck
Browse files
Options
Browse Files
Download
Plain Diff
Pull ticket-spinaphore into release branch
parents
48fade6c
883a3acf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
arch/ia64/mm/tlb.c
arch/ia64/mm/tlb.c
+18
-6
No files found.
arch/ia64/mm/tlb.c
View file @
8add570a
...
...
@@ -100,24 +100,36 @@ wrap_mmu_context (struct mm_struct *mm)
* this primitive it can be moved up to a spinaphore.h header.
*/
struct
spinaphore
{
atomic_t
cur
;
unsigned
long
ticket
;
unsigned
long
serve
;
};
static
inline
void
spinaphore_init
(
struct
spinaphore
*
ss
,
int
val
)
{
atomic_set
(
&
ss
->
cur
,
val
);
ss
->
ticket
=
0
;
ss
->
serve
=
val
;
}
static
inline
void
down_spin
(
struct
spinaphore
*
ss
)
{
while
(
unlikely
(
!
atomic_add_unless
(
&
ss
->
cur
,
-
1
,
0
)))
while
(
atomic_read
(
&
ss
->
cur
)
==
0
)
cpu_relax
();
unsigned
long
t
=
ia64_fetchadd
(
1
,
&
ss
->
ticket
,
acq
),
serve
;
if
(
time_before
(
t
,
ss
->
serve
))
return
;
ia64_invala
();
for
(;;)
{
asm
volatile
(
"ld4.c.nc %0=[%1]"
:
"=r"
(
serve
)
:
"r"
(
&
ss
->
serve
)
:
"memory"
);
if
(
time_before
(
t
,
serve
))
return
;
cpu_relax
();
}
}
static
inline
void
up_spin
(
struct
spinaphore
*
ss
)
{
atomic_add
(
1
,
&
ss
->
cur
);
ia64_fetchadd
(
1
,
&
ss
->
serve
,
rel
);
}
static
struct
spinaphore
ptcg_sem
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment