FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
linux/kernel/lglock.c at master · binarysentient/linux · GitHub
binarysentient
/
linux
Public
forked from
torvalds/linux
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
linux
/
kernel
/
lglock.c
Copy path
More file actions
More file actions
Latest commit
History
History
History
89 lines (75 loc) · 1.92 KB
Breadcrumbs
linux
/
kernel
/
lglock.c
Copy path
File metadata and controls
89 lines (75 loc) · 1.92 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* See include/linux/lglock.h for description */
#include
<linux/module.h>
#include
<linux/lglock.h>
#include
<linux/cpu.h>
#include
<linux/string.h>
/*
* Note there is no uninit, so lglocks cannot be defined in
* modules (but it's fine to use them from there)
* Could be added though, just undo lg_lock_init
*/
void
lg_lock_init
(
struct
lglock
*
lg
,
char
*
name
)
{
LOCKDEP_INIT_MAP
(
&
lg
->
lock_dep_map
,
name
,
&
lg
->
lock_key
,
0
);
}
EXPORT_SYMBOL
(
lg_lock_init
);
void
lg_local_lock
(
struct
lglock
*
lg
)
{
arch_spinlock_t
*
lock
;
preempt_disable
();
rwlock_acquire_read
(
&
lg
->
lock_dep_map
,
0
,
0
,
_RET_IP_
);
lock
=
this_cpu_ptr
(
lg
->
lock
);
arch_spin_lock
(
lock
);
}
EXPORT_SYMBOL
(
lg_local_lock
);
void
lg_local_unlock
(
struct
lglock
*
lg
)
{
arch_spinlock_t
*
lock
;
rwlock_release
(
&
lg
->
lock_dep_map
,
1
,
_RET_IP_
);
lock
=
this_cpu_ptr
(
lg
->
lock
);
arch_spin_unlock
(
lock
);
preempt_enable
();
}
EXPORT_SYMBOL
(
lg_local_unlock
);
void
lg_local_lock_cpu
(
struct
lglock
*
lg
,
int
cpu
)
{
arch_spinlock_t
*
lock
;
preempt_disable
();
rwlock_acquire_read
(
&
lg
->
lock_dep_map
,
0
,
0
,
_RET_IP_
);
lock
=
per_cpu_ptr
(
lg
->
lock
,
cpu
);
arch_spin_lock
(
lock
);
}
EXPORT_SYMBOL
(
lg_local_lock_cpu
);
void
lg_local_unlock_cpu
(
struct
lglock
*
lg
,
int
cpu
)
{
arch_spinlock_t
*
lock
;
rwlock_release
(
&
lg
->
lock_dep_map
,
1
,
_RET_IP_
);
lock
=
per_cpu_ptr
(
lg
->
lock
,
cpu
);
arch_spin_unlock
(
lock
);
preempt_enable
();
}
EXPORT_SYMBOL
(
lg_local_unlock_cpu
);
void
lg_global_lock
(
struct
lglock
*
lg
)
{
int
i
;
preempt_disable
();
rwlock_acquire
(
&
lg
->
lock_dep_map
,
0
,
0
,
_RET_IP_
);
for_each_possible_cpu
(
i
) {
arch_spinlock_t
*
lock
;
lock
=
per_cpu_ptr
(
lg
->
lock
,
i
);
arch_spin_lock
(
lock
);
}
}
EXPORT_SYMBOL
(
lg_global_lock
);
void
lg_global_unlock
(
struct
lglock
*
lg
)
{
int
i
;
rwlock_release
(
&
lg
->
lock_dep_map
,
1
,
_RET_IP_
);
for_each_possible_cpu
(
i
) {
arch_spinlock_t
*
lock
;
lock
=
per_cpu_ptr
(
lg
->
lock
,
i
);
arch_spin_unlock
(
lock
);
}
preempt_enable
();
}
EXPORT_SYMBOL
(
lg_global_unlock
);
Back
|
FazBrowse Home
|
New Git URL