diff options
author | Michal Hocko <mhocko@suse.com> | 2016-04-07 11:12:29 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-04-13 04:42:22 -0400 |
commit | 4edab14ec66fae5b3c7c4969295facf70365f39d (patch) | |
tree | 20ebf097e3557707570055ae0ecbf8d63a227ace | |
parent | a02137eb5177e7afc8dfa52a2888c1f2f4840739 (diff) |
locking/rwsem, s390: Provide __down_write_killable()
Introduce ___down_write() for the fast path and reuse it for __down_write()
resp. __down_write_killable() each using the respective generic slow path
(rwsem_down_write_failed() resp. rwsem_down_write_failed_killable()).
Signed-off-by: Michal Hocko <mhocko@suse.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Chris Zankel <chris@zankel.net>
Cc: David S. Miller <davem@davemloft.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Cc: Signed-off-by: Jason Low <jason.low2@hp.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-alpha@vger.kernel.org
Cc: linux-arch@vger.kernel.org
Cc: linux-ia64@vger.kernel.org
Cc: linux-s390@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Cc: linux-xtensa@linux-xtensa.org
Cc: sparclinux@vger.kernel.org
Link: http://lkml.kernel.org/r/1460041951-22347-10-git-send-email-mhocko@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/s390/include/asm/rwsem.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/arch/s390/include/asm/rwsem.h b/arch/s390/include/asm/rwsem.h index 555d23b6b6d1..c75e4471e618 100644 --- a/arch/s390/include/asm/rwsem.h +++ b/arch/s390/include/asm/rwsem.h | |||
@@ -90,7 +90,7 @@ static inline int __down_read_trylock(struct rw_semaphore *sem) | |||
90 | /* | 90 | /* |
91 | * lock for writing | 91 | * lock for writing |
92 | */ | 92 | */ |
93 | static inline void __down_write(struct rw_semaphore *sem) | 93 | static inline long ___down_write(struct rw_semaphore *sem) |
94 | { | 94 | { |
95 | signed long old, new, tmp; | 95 | signed long old, new, tmp; |
96 | 96 | ||
@@ -104,10 +104,25 @@ static inline void __down_write(struct rw_semaphore *sem) | |||
104 | : "=&d" (old), "=&d" (new), "=Q" (sem->count) | 104 | : "=&d" (old), "=&d" (new), "=Q" (sem->count) |
105 | : "Q" (sem->count), "m" (tmp) | 105 | : "Q" (sem->count), "m" (tmp) |
106 | : "cc", "memory"); | 106 | : "cc", "memory"); |
107 | if (old != 0) | 107 | |
108 | return old; | ||
109 | } | ||
110 | |||
111 | static inline void __down_write(struct rw_semaphore *sem) | ||
112 | { | ||
113 | if (___down_write(sem)) | ||
108 | rwsem_down_write_failed(sem); | 114 | rwsem_down_write_failed(sem); |
109 | } | 115 | } |
110 | 116 | ||
117 | static inline int __down_write_killable(struct rw_semaphore *sem) | ||
118 | { | ||
119 | if (___down_write(sem)) | ||
120 | if (IS_ERR(rwsem_down_write_failed_killable(sem))) | ||
121 | return -EINTR; | ||
122 | |||
123 | return 0; | ||
124 | } | ||
125 | |||
111 | /* | 126 | /* |
112 | * trylock for writing -- returns 1 if successful, 0 if contention | 127 | * trylock for writing -- returns 1 if successful, 0 if contention |
113 | */ | 128 | */ |