Skip to content

Commit

Permalink
rcuwait: Let rcuwait_wake_up() return whether or not a task was awoken
Browse files Browse the repository at this point in the history
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) <[email protected]>
Signed-off-by: Davidlohr Bueso <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
Davidlohr Bueso authored and bonzini committed May 13, 2020
1 parent c9d64a1 commit 9d9a6eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/linux/rcuwait.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
7 changes: 5 additions & 2 deletions kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,9 @@ void release_task(struct task_struct *p)
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();
Expand All @@ -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);

Expand Down

0 comments on commit 9d9a6eb

Please sign in to comment.