rcuwait: Let rcuwait_wake_up() return whether or not a task was awoken
authorDavidlohr Bueso <dave@stgolabs.net>
Fri, 24 Apr 2020 05:48:34 +0000 (22:48 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 13 May 2020 16:14:52 +0000 (12:14 -0400)
Propagating the return value of wake_up_process() back to the caller
can come in handy for future users, such as for statistics or
accounting purposes.

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Message-Id: <20200424054837.5138-3-dave@stgolabs.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/linux/rcuwait.h
kernel/exit.c

index 2ffe1ee..6ebb232 100644 (file)
@@ -25,7 +25,7 @@ static inline void rcuwait_init(struct rcuwait *w)
        w->task = NULL;
 }
 
-extern void rcuwait_wake_up(struct rcuwait *w);
+extern int rcuwait_wake_up(struct rcuwait *w);
 
 /*
  * The caller is responsible for locking around rcuwait_wait_event(),
index 9f9015f..f3beb63 100644 (file)
@@ -227,8 +227,9 @@ repeat:
                goto repeat;
 }
 
-void rcuwait_wake_up(struct rcuwait *w)
+int rcuwait_wake_up(struct rcuwait *w)
 {
+       int ret = 0;
        struct task_struct *task;
 
        rcu_read_lock();
@@ -248,8 +249,10 @@ void rcuwait_wake_up(struct rcuwait *w)
 
        task = rcu_dereference(w->task);
        if (task)
-               wake_up_process(task);
+               ret = wake_up_process(task);
        rcu_read_unlock();
+
+       return ret;
 }
 EXPORT_SYMBOL_GPL(rcuwait_wake_up);