Message ID | 20200320085527.23861-2-dave@stgolabs.net (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Lock ordering documentation and annotation for lockdep | expand |
On 2020-03-20 01:55:25 [-0700], Davidlohr Bueso wrote: > Let the caller know if wake_up_process() was actually called or not; > some users can use this information for ad-hoc. Of course returning > true does not guarantee that wake_up_process() actually woke anything > up. Wouldn't it make sense to return wake_up_process() return value to know if a change of state occurred or not? Sebastian
On Fri, Mar 20, 2020 at 01:55:25AM -0700, Davidlohr Bueso wrote: > diff --git a/kernel/exit.c b/kernel/exit.c > index 6cc6cc485d07..b0bb0a8ec4b1 100644 > --- a/kernel/exit.c > +++ b/kernel/exit.c > @@ -234,9 +234,10 @@ void release_task(struct task_struct *p) > goto repeat; > } > > -void rcuwait_wake_up(struct rcuwait *w) > +bool rcuwait_wake_up(struct rcuwait *w) > { > struct task_struct *task; > + bool ret = false; > > rcu_read_lock(); > > @@ -254,10 +255,15 @@ void rcuwait_wake_up(struct rcuwait *w) > smp_mb(); /* (B) */ > > task = rcu_dereference(w->task); > - if (task) > + if (task) { > wake_up_process(task); > + ret = true; ret = wake_up_process(task); ? > + } > rcu_read_unlock(); > + > + return ret; > } > +EXPORT_SYMBOL_GPL(rcuwait_wake_up);
diff --git a/include/linux/rcuwait.h b/include/linux/rcuwait.h index 6e8798458091..3f83b9a12ad3 100644 --- a/include/linux/rcuwait.h +++ b/include/linux/rcuwait.h @@ -24,7 +24,7 @@ static inline void rcuwait_init(struct rcuwait *w) w->task = NULL; } -extern void rcuwait_wake_up(struct rcuwait *w); +extern bool rcuwait_wake_up(struct rcuwait *w); /* * The caller is responsible for locking around rcuwait_wait_event(), diff --git a/kernel/exit.c b/kernel/exit.c index 6cc6cc485d07..b0bb0a8ec4b1 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -234,9 +234,10 @@ void release_task(struct task_struct *p) goto repeat; } -void rcuwait_wake_up(struct rcuwait *w) +bool rcuwait_wake_up(struct rcuwait *w) { struct task_struct *task; + bool ret = false; rcu_read_lock(); @@ -254,10 +255,15 @@ void rcuwait_wake_up(struct rcuwait *w) smp_mb(); /* (B) */ task = rcu_dereference(w->task); - if (task) + if (task) { wake_up_process(task); + ret = true; + } rcu_read_unlock(); + + return ret; } +EXPORT_SYMBOL_GPL(rcuwait_wake_up); /* * Determine if a process group is "orphaned", according to the POSIX
Let the caller know if wake_up_process() was actually called or not; some users can use this information for ad-hoc. Of course returning true does not guarantee that wake_up_process() actually woke anything up. Signed-off-by: Davidlohr Bueso <dbueso@suse.de> --- include/linux/rcuwait.h | 2 +- kernel/exit.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-)