Commit 9d9a6ebf authored by Davidlohr Bueso's avatar Davidlohr Bueso Committed by Paolo Bonzini

rcuwait: Let rcuwait_wake_up() return whether or not a task was awoken

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: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarDavidlohr Bueso <dbueso@suse.de>
Message-Id: <20200424054837.5138-3-dave@stgolabs.net>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent c9d64a1b
...@@ -25,7 +25,7 @@ static inline void rcuwait_init(struct rcuwait *w) ...@@ -25,7 +25,7 @@ static inline void rcuwait_init(struct rcuwait *w)
w->task = NULL; 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(), * The caller is responsible for locking around rcuwait_wait_event(),
......
...@@ -227,8 +227,9 @@ void release_task(struct task_struct *p) ...@@ -227,8 +227,9 @@ void release_task(struct task_struct *p)
goto repeat; goto repeat;
} }
void rcuwait_wake_up(struct rcuwait *w) int rcuwait_wake_up(struct rcuwait *w)
{ {
int ret = 0;
struct task_struct *task; struct task_struct *task;
rcu_read_lock(); rcu_read_lock();
...@@ -248,8 +249,10 @@ void rcuwait_wake_up(struct rcuwait *w) ...@@ -248,8 +249,10 @@ void rcuwait_wake_up(struct rcuwait *w)
task = rcu_dereference(w->task); task = rcu_dereference(w->task);
if (task) if (task)
wake_up_process(task); ret = wake_up_process(task);
rcu_read_unlock(); rcu_read_unlock();
return ret;
} }
EXPORT_SYMBOL_GPL(rcuwait_wake_up); EXPORT_SYMBOL_GPL(rcuwait_wake_up);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment