[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200424054837.5138-5-dave@stgolabs.net>
Date: Thu, 23 Apr 2020 22:48:36 -0700
From: Davidlohr Bueso <dave@...olabs.net>
To: tglx@...utronix.de, pbonzini@...hat.com
Cc: peterz@...radead.org, maz@...nel.org, bigeasy@...utronix.de,
rostedt@...dmis.org, torvalds@...ux-foundation.org,
will@...nel.org, joel@...lfernandes.org,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
dave@...olabs.net, Davidlohr Bueso <dbueso@...e.de>
Subject: [PATCH 4/5] rcuwait: Introduce rcuwait_active()
This call is lockless and thus should not be trustedblindly,
ie: for wakeup purposes, which is already provided correctly
by rcuwait_wakeup().
Signed-off-by: Davidlohr Bueso <dbueso@...e.de>
---
include/linux/rcuwait.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/linux/rcuwait.h b/include/linux/rcuwait.h
index 45bc6604e9b1..c1414ce44abc 100644
--- a/include/linux/rcuwait.h
+++ b/include/linux/rcuwait.h
@@ -25,6 +25,15 @@ static inline void rcuwait_init(struct rcuwait *w)
w->task = NULL;
}
+/*
+ * Note: this provides no serialization and, just as with waitqueues,
+ * requires care to estimate as to whether or not the wait is active.
+ */
+static inline int rcuwait_active(struct rcuwait *w)
+{
+ return !!rcu_dereference(w->task);
+}
+
extern int rcuwait_wake_up(struct rcuwait *w);
/*
--
2.16.4
Powered by blists - more mailing lists