Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1606830
| From | Waiman Long <longman@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH-tip v6 05/22] futex: Add helpers to get & cmpxchg futex value without lock |
| Date | 2017-03-22 18:50 +0100 |
| Message-ID | <tnSyv-6bg-49@gated-at.bofh.it> (permalink) |
| References | <tnSyt-6bg-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Two new helper functions cmpxchg_futex_value() and get_futex_value()
are added to access and change the futex value without the hash
bucket lock. As a result, page fault is enabled and the page will
be faulted in if not present yet.
Signed-off-by: Waiman Long <longman@redhat.com>
---
kernel/futex.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/kernel/futex.c b/kernel/futex.c
index 20aed91..9a27a79 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -805,6 +805,21 @@ static int get_futex_value_locked(u32 *dest, u32 __user *from)
return ret ? -EFAULT : 0;
}
+/*
+ * The equivalents of the above cmpxchg_futex_value_locked() and
+ * get_futex_value_locked which are called without the hash bucket lock
+ * and so can have page fault enabled.
+ */
+static inline int cmpxchg_futex_value(u32 *curval, u32 __user *uaddr,
+ u32 uval, u32 newval)
+{
+ return futex_atomic_cmpxchg_inatomic(curval, uaddr, uval, newval);
+}
+
+static inline int get_futex_value(u32 *dest, u32 __user *from)
+{
+ return __get_user(*dest, from);
+}
/*
* PI code:
--
1.8.3.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH-tip v6 00/22] futex: Introducing throughput-optimized (TP) futexes Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 12/22] TP-futex: Return status code on FUTEX_LOCK calls Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 11/22] TP-futex: Implement lock handoff to prevent lock starvation Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 20/22] perf bench: Extend mutex/rwlock futex suite to test TP futexes Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 21/22] sched, TP-futex: Make wake_up_q() return wakeup count Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 02/22] perf bench: New microbenchmark for userspace rwlock performance Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 03/22] futex: Consolidate duplicated timer setup code Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 04/22] futex: Rename futex_pi_state to futex_state Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 22/22] futex: Dump internal futex state via debugfs Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 19/22] TP-futex, doc: Update TP futexes document on shared locking Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 08/22] futex: Allow direct attachment of futex_state objects to hash bucket Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 09/22] futex: Introduce throughput-optimized (TP) futexes Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 01/22] perf bench: New microbenchmark for userspace mutex performance Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 18/22] TP-futex: Group readers together in wait queue Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
Re: [PATCH-tip v6 18/22] TP-futex: Group readers together in wait queue kbuild test robot <lkp@intel.com> - 2017-03-24 09:30 +0100
Re: [PATCH-tip v6 18/22] TP-futex: Group readers together in wait queue kbuild test robot <lkp@intel.com> - 2017-03-24 09:40 +0100
[PATCH-tip v6 16/22] TP-futex: Support userspace reader/writer locks Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 13/22] TP-futex: Add timeout support Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 17/22] TP-futex: Enable kernel reader lock stealing Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 05/22] futex: Add helpers to get & cmpxchg futex value without lock Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 10/22] TP-futex: Enable robust handling Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 07/22] futex: Add a new futex type field into futex_state Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 15/22] TP-futex, doc: Add TP futexes documentation Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
[PATCH-tip v6 14/22] TP-futex: Optionally return EAGAIN for userspace locking Waiman Long <longman@redhat.com> - 2017-03-22 18:50 +0100
csiph-web