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
Kirill Smelkov
linux
Commits
887bddfa
Commit
887bddfa
authored
May 26, 2016
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add down_write_killable_nested()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
d42b3868
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
include/linux/rwsem.h
include/linux/rwsem.h
+2
-0
kernel/locking/rwsem.c
kernel/locking/rwsem.c
+16
-0
No files found.
include/linux/rwsem.h
View file @
887bddfa
...
...
@@ -156,6 +156,7 @@ extern void downgrade_write(struct rw_semaphore *sem);
*/
extern
void
down_read_nested
(
struct
rw_semaphore
*
sem
,
int
subclass
);
extern
void
down_write_nested
(
struct
rw_semaphore
*
sem
,
int
subclass
);
extern
int
down_write_killable_nested
(
struct
rw_semaphore
*
sem
,
int
subclass
);
extern
void
_down_write_nest_lock
(
struct
rw_semaphore
*
sem
,
struct
lockdep_map
*
nest_lock
);
# define down_write_nest_lock(sem, nest_lock) \
...
...
@@ -176,6 +177,7 @@ extern void up_read_non_owner(struct rw_semaphore *sem);
# define down_read_nested(sem, subclass) down_read(sem)
# define down_write_nest_lock(sem, nest_lock) down_write(sem)
# define down_write_nested(sem, subclass) down_write(sem)
# define down_write_killable_nested(sem, subclass) down_write_killable(sem)
# define down_read_non_owner(sem) down_read(sem)
# define up_read_non_owner(sem) up_read(sem)
#endif
...
...
kernel/locking/rwsem.c
View file @
887bddfa
...
...
@@ -173,6 +173,22 @@ void down_write_nested(struct rw_semaphore *sem, int subclass)
EXPORT_SYMBOL
(
down_write_nested
);
int
__sched
down_write_killable_nested
(
struct
rw_semaphore
*
sem
,
int
subclass
)
{
might_sleep
();
rwsem_acquire
(
&
sem
->
dep_map
,
subclass
,
0
,
_RET_IP_
);
if
(
LOCK_CONTENDED_RETURN
(
sem
,
__down_write_trylock
,
__down_write_killable
))
{
rwsem_release
(
&
sem
->
dep_map
,
1
,
_RET_IP_
);
return
-
EINTR
;
}
rwsem_set_owner
(
sem
);
return
0
;
}
EXPORT_SYMBOL
(
down_write_killable_nested
);
void
up_read_non_owner
(
struct
rw_semaphore
*
sem
)
{
__up_read
(
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