Skip to contentSkip to conversation

perf/bench-futex: Simplify wrapper for LOCK_PI

PATCH Applied Davidlohr Bueso 3 participants 3 messages Apr 21, 2016 – Apr 27, 2016

Subsystems (2)
lore
Share & tools
lore

Davidlohr Bueso

author reviewer
#0 lore raw

PATCH 1/1 perf/bench-futex: Simplify wrapper for LOCK_PI

Given that the 'val' parameter is ignored for FUTEX_LOCK_PI, get rid of the bogus deadlock detection flag in the wrapper code and avoid the extra argument, making it resemble its unlock counterpart. And if nothing else, we already only pass 0 anyway.

---
 tools/perf/bench/futex-lock-pi.c | 2 +-
 tools/perf/bench/futex.h         | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)
tools/perf/bench/futex-lock-pi.c +1 -1
index 6a18ce21f865..6952db65508a 100644
@@ -83,7 +83,7 @@ static void *workerfn(void *arg)
 	do {
 		int ret;
 	again:
-		ret = futex_lock_pi(w->futex, NULL, 0, futex_flag);
+		ret = futex_lock_pi(w->futex, NULL, futex_flag);
 
 		if (ret) { /* handle lock acquisition */
 			if (!silent)
tools/perf/bench/futex.h +2 -4
index aca900fdc788..f0501edba0e7 100644
@@ -57,13 +57,11 @@ futex_wake(u_int32_t *uaddr, int nr_wake, int opflags)
 
 /**
  * futex_lock_pi() - block on uaddr as a PI mutex
- * @detect:	whether (1) or not (0) to perform deadlock detection
  */
 static inline int
-futex_lock_pi(u_int32_t *uaddr, struct timespec *timeout, int detect,
-	      int opflags)
+futex_lock_pi(u_int32_t *uaddr, struct timespec *timeout, int opflags)
 {
-	return futex(uaddr, FUTEX_LOCK_PI, detect, timeout, NULL, 0, opflags);
+	return futex(uaddr, FUTEX_LOCK_PI, 0, timeout, NULL, 0, opflags);
 }
 
 /**
Signature · 1 line
2.8.1
maintainer Applied
#1 lore raw

Em Wed, Apr 20, 2016 at 08:14:07PM -0700, Davidlohr Bueso escreveu:

Quoted 4 lines

Given that the 'val' parameter is ignored for FUTEX_LOCK_PI, get rid of the bogus deadlock detection flag in the wrapper code and avoid the extra argument, making it resemble its unlock counterpart. And if nothing else, we already only pass 0 anyway.

Thanks, applied.

- Arnaldo

#2 lore raw

[tip:perf/core] perf bench futex: Simplify wrapper for LOCK_PI

In reply to Davidlohr Bueso
perf bench futex: Simplify wrapper for LOCK_PI
Commit-ID:  73b1794e252b0476cc6e46461c7612cbaa88be45
Gitweb:     http://git.kernel.org/tip/73b1794e252b0476cc6e46461c7612cbaa88be45
Author:     Davidlohr Bueso <[email protected]>
AuthorDate: Wed, 20 Apr 2016 20:14:07 -0700
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 25 Apr 2016 20:24:26 -0300

perf bench futex: Simplify wrapper for LOCK_PI

Given that the 'val' parameter is ignored for FUTEX_LOCK_PI, get rid of the bogus deadlock detection flag in the wrapper code and avoid the extra argument, making it resemble its unlock counterpart. And if nothing else, we already only pass 0 anyway.

---
 tools/perf/bench/futex-lock-pi.c | 2 +-
 tools/perf/bench/futex.h         | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)
tools/perf/bench/futex-lock-pi.c +1 -1
index 6a18ce2..6952db6 100644
@@ -83,7 +83,7 @@ static void *workerfn(void *arg)
 	do {
 		int ret;
 	again:
-		ret = futex_lock_pi(w->futex, NULL, 0, futex_flag);
+		ret = futex_lock_pi(w->futex, NULL, futex_flag);
 
 		if (ret) { /* handle lock acquisition */
 			if (!silent)
tools/perf/bench/futex.h +2 -4
index d44de9f..b2e06d1 100644
@@ -57,13 +57,11 @@ futex_wake(u_int32_t *uaddr, int nr_wake, int opflags)
 
 /**
  * futex_lock_pi() - block on uaddr as a PI mutex
- * @detect:	whether (1) or not (0) to perform deadlock detection
  */
 static inline int
-futex_lock_pi(u_int32_t *uaddr, struct timespec *timeout, int detect,
-	      int opflags)
+futex_lock_pi(u_int32_t *uaddr, struct timespec *timeout, int opflags)
 {
-	return futex(uaddr, FUTEX_LOCK_PI, detect, timeout, NULL, 0, opflags);
+	return futex(uaddr, FUTEX_LOCK_PI, 0, timeout, NULL, 0, opflags);
 }
 
 /**