Skip to content

Commit c090511

Browse files
Kirill TkhaiIngo Molnar
authored andcommitted
locking/arch, ia64: 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/150670116749.23930.14976888440968191759.stgit@localhost.localdomain Signed-off-by: Ingo Molnar <[email protected]>
1 parent 8c74392 commit c090511

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

arch/ia64/include/asm/rwsem.h

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,31 @@
3737
/*
3838
* lock for reading
3939
*/
40-
static inline void
41-
__down_read (struct rw_semaphore *sem)
40+
static inline int
41+
___down_read (struct rw_semaphore *sem)
4242
{
4343
long result = ia64_fetchadd8_acq((unsigned long *)&sem->count.counter, 1);
4444

45-
if (result < 0)
45+
return (result < 0);
46+
}
47+
48+
static inline void
49+
__down_read (struct rw_semaphore *sem)
50+
{
51+
if (___down_read(sem))
4652
rwsem_down_read_failed(sem);
4753
}
4854

55+
static inline int
56+
__down_read_killable (struct rw_semaphore *sem)
57+
{
58+
if (___down_read(sem))
59+
if (IS_ERR(rwsem_down_read_failed_killable(sem)))
60+
return -EINTR;
61+
62+
return 0;
63+
}
64+
4965
/*
5066
* lock for writing
5167
*/
@@ -72,9 +88,10 @@ __down_write (struct rw_semaphore *sem)
7288
static inline int
7389
__down_write_killable (struct rw_semaphore *sem)
7490
{
75-
if (___down_write(sem))
91+
if (___down_write(sem)) {
7692
if (IS_ERR(rwsem_down_write_failed_killable(sem)))
7793
return -EINTR;
94+
}
7895

7996
return 0;
8097
}

0 commit comments

Comments
 (0)