diff options
author | Davidlohr Bueso <dave@stgolabs.net> | 2020-04-23 22:48:36 -0700 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-05-13 12:14:54 -0400 |
commit | 191a43be61d6791fd4a9098a35c1a09e73f55228 (patch) | |
tree | 6c66c7930e5312879078bb39d11e4485e233c29d /include/linux/rcuwait.h | |
parent | 5c21f7b322cb9fcb97f2e22f5976a0ae8dd71354 (diff) | |
download | lwn-191a43be61d6791fd4a9098a35c1a09e73f55228.tar.gz lwn-191a43be61d6791fd4a9098a35c1a09e73f55228.zip |
rcuwait: Introduce rcuwait_active()
This call is lockless and thus should not be trusted blindly.
For example, the return value of rcuwait_wakeup() should be used to
track whether a process was woken up.
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Message-Id: <20200424054837.5138-5-dave@stgolabs.net>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/linux/rcuwait.h')
-rw-r--r-- | include/linux/rcuwait.h | 9 |
1 files changed, 9 insertions, 0 deletions
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); /* |