Skip to content

Commit a61ba2c

Browse files
Kirill TkhaiIngo Molnar
authored andcommitted
locking/arch, s390: Add __down_read_killable()
Similar to __down_write_killable(), and read killable primitive. Signed-off-by: Kirill Tkhai <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: http://lkml.kernel.org/r/150670117817.23930.13068785028558453848.stgit@localhost.localdomain Signed-off-by: Ingo Molnar <[email protected]>
1 parent c090511 commit a61ba2c

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

arch/s390/include/asm/rwsem.h

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
/*
5050
* lock for reading
5151
*/
52-
static inline void __down_read(struct rw_semaphore *sem)
52+
static inline int ___down_read(struct rw_semaphore *sem)
5353
{
5454
signed long old, new;
5555

@@ -62,10 +62,25 @@ static inline void __down_read(struct rw_semaphore *sem)
6262
: "=&d" (old), "=&d" (new), "=Q" (sem->count)
6363
: "Q" (sem->count), "i" (RWSEM_ACTIVE_READ_BIAS)
6464
: "cc", "memory");
65-
if (old < 0)
65+
return (old < 0);
66+
}
67+
68+
static inline void __down_read(struct rw_semaphore *sem)
69+
{
70+
if (___down_read(sem))
6671
rwsem_down_read_failed(sem);
6772
}
6873

74+
static inline int __down_read_killable(struct rw_semaphore *sem)
75+
{
76+
if (___down_read(sem)) {
77+
if (IS_ERR(rwsem_down_read_failed_killable(sem)))
78+
return -EINTR;
79+
}
80+
81+
return 0;
82+
}
83+
6984
/*
7085
* trylock for reading -- returns 1 if successful, 0 if contention
7186
*/

0 commit comments

Comments
 (0)