From: Davidlohr Bueso Date: Fri, 24 Apr 2020 05:48:36 +0000 (-0700) Subject: rcuwait: Introduce rcuwait_active() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=191a43be61d6791fd4a9098a35c1a09e73f55228;p=linux.git 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 Message-Id: <20200424054837.5138-5-dave@stgolabs.net> Acked-by: Peter Zijlstra (Intel) Signed-off-by: Paolo Bonzini --- diff --git a/include/linux/rcuwait.h b/include/linux/rcuwait.h index 45bc6604e9b12..c1414ce44abc3 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); /*