[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <150670116749.23930.14976888440968191759.stgit@localhost.localdomain>
Date: Fri, 29 Sep 2017 19:06:07 +0300
From: Kirill Tkhai <ktkhai@...tuozzo.com>
To: linux-ia64@...r.kernel.org, avagin@...tuozzo.com,
peterz@...radead.org, heiko.carstens@...ibm.com, hpa@...or.com,
gorcunov@...tuozzo.com, linux-arch@...r.kernel.org,
linux-s390@...r.kernel.org, x86@...nel.org, mingo@...hat.com,
mattst88@...il.com, fenghua.yu@...el.com, arnd@...db.de,
ktkhai@...tuozzo.com, ink@...assic.park.msu.ru, tglx@...utronix.de,
rth@...ddle.net, tony.luck@...el.com, linux-kernel@...r.kernel.org,
linux-alpha@...r.kernel.org, schwidefsky@...ibm.com,
davem@...emloft.net, rientjes@...gle.com, viro@...iv.linux.org.uk
Subject: [PATCH REBASED 2/6] ia64: Add __down_read_killable()
Similar to __down_write_killable(), and read killable primitive.
Signed-off-by: Kirill Tkhai <ktkhai@...tuozzo.com>
---
arch/ia64/include/asm/rwsem.h | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/arch/ia64/include/asm/rwsem.h b/arch/ia64/include/asm/rwsem.h
index 8fa98dd303b4..1fb8b7cb1c98 100644
--- a/arch/ia64/include/asm/rwsem.h
+++ b/arch/ia64/include/asm/rwsem.h
@@ -37,15 +37,31 @@
/*
* lock for reading
*/
-static inline void
-__down_read (struct rw_semaphore *sem)
+static inline int
+___down_read (struct rw_semaphore *sem)
{
long result = ia64_fetchadd8_acq((unsigned long *)&sem->count.counter, 1);
- if (result < 0)
+ return (result < 0);
+}
+
+static inline void
+__down_read (struct rw_semaphore *sem)
+{
+ if (___down_read(sem))
rwsem_down_read_failed(sem);
}
+static inline int
+__down_read_killable (struct rw_semaphore *sem)
+{
+ if (___down_read(sem))
+ if (IS_ERR(rwsem_down_read_failed_killable(sem)))
+ return -EINTR;
+
+ return 0;
+}
+
/*
* lock for writing
*/
Powered by blists - more mailing lists