From da2f34d35fd8ad11a8db9b7ab3b387fe7ec2e709 Mon Sep 17 00:00:00 2001
From: Davidlohr Bueso <dbueso@suse.de>
Date: Tue, 24 Mar 2020 11:23:30 -0700
Subject: [PATCH] rcuwait: Let rcuwait_wake_up() return whether or not a task was awoken
References: bsc#1167594
Git-commit: 9d9a6ebfea329cadeda87544dceae01e9c27aaef
Patch-mainline: v5.8-rc1
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.
Link: https://lore.kernel.org/lkml/20200324044453.15733-3-dave@stgolabs.net
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
include/linux/rcuwait.h | 2 +-
kernel/exit.c | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/linux/rcuwait.h b/include/linux/rcuwait.h
index 75c97e4bbc57..0a9133bb60e8 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 int 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 c7248d34a0f3..e88db7c1d6a5 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -234,8 +234,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();
@@ -255,9 +256,12 @@ 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);
/*
* Determine if a process group is "orphaned", according to the POSIX
--
2.16.4