All of lore.kernel.org
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: tglx@linutronix.de, pbonzini@redhat.com
Cc: bigeasy@linutronix.de, peterz@infradead.org, rostedt@goodmis.org,
	torvalds@linux-foundation.org, will@kernel.org,
	joel@joelfernandes.org, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org, dave@stgolabs.net,
	Davidlohr Bueso <dbueso@suse.de>
Subject: [PATCH 2/5] rcuwait: Let rcuwait_wake_up() return whether or not a task was awoken
Date: Tue, 21 Apr 2020 21:07:36 -0700	[thread overview]
Message-ID: <20200422040739.18601-3-dave@stgolabs.net> (raw)
In-Reply-To: <20200422040739.18601-1-dave@stgolabs.net>

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.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
 include/linux/rcuwait.h | 2 +-
 kernel/exit.c           | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/linux/rcuwait.h b/include/linux/rcuwait.h
index 2ffe1ee6d482..6ebb23258a27 100644
--- a/include/linux/rcuwait.h
+++ b/include/linux/rcuwait.h
@@ -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(),
diff --git a/kernel/exit.c b/kernel/exit.c
index 9f9015f3f6b0..f3beb637acf7 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -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();
@@ -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);
 
-- 
2.16.4


  parent reply	other threads:[~2020-04-22  4:11 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22  4:07 [PATCH v3 -tip 0/5] kvm: Use rcuwait for vcpu blocking Davidlohr Bueso
2020-04-22  4:07 ` [PATCH 1/5] rcuwait: Fix stale wake call name in comment Davidlohr Bueso
2020-04-22  4:07 ` Davidlohr Bueso [this message]
2020-04-22  4:07 ` [PATCH 3/5] rcuwait: Introduce prepare_to and finish_rcuwait Davidlohr Bueso
2020-04-23  9:23   ` Peter Zijlstra
2020-04-22  4:07 ` [PATCH 4/5] kvm: Replace vcpu->swait with rcuwait Davidlohr Bueso
2020-04-22  4:07   ` Davidlohr Bueso
2020-04-22  8:32   ` Paolo Bonzini
2020-04-22  8:32     ` Paolo Bonzini
2020-04-22 10:14   ` Marc Zyngier
2020-04-22 10:14     ` Marc Zyngier
2020-04-23  8:41   ` Marc Zyngier
2020-04-23  8:41     ` Marc Zyngier
2020-04-23  8:57     ` Paolo Bonzini
2020-04-23  8:57       ` Paolo Bonzini
2020-04-23  9:19       ` Peter Zijlstra
2020-04-23  9:19         ` Peter Zijlstra
2020-04-23  9:26         ` Paolo Bonzini
2020-04-23  9:26           ` Paolo Bonzini
2020-04-22  4:07 ` [PATCH 5/5] sched/swait: Reword some of the main description Davidlohr Bueso
2020-05-01 18:22   ` [tip: sched/core] " tip-bot2 for Davidlohr Bueso
2020-04-22 11:33 ` [PATCH v3 -tip 0/5] kvm: Use rcuwait for vcpu blocking Peter Zijlstra
2020-04-24  5:48 [PATCH v4 " Davidlohr Bueso
2020-04-24  5:48 ` [PATCH 2/5] rcuwait: Let rcuwait_wake_up() return whether or not a task was awoken Davidlohr Bueso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200422040739.18601-3-dave@stgolabs.net \
    --to=dave@stgolabs.net \
    --cc=bigeasy@linutronix.de \
    --cc=dbueso@suse.de \
    --cc=joel@joelfernandes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.