Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1548139
| Path | csiph.com!1.us.feeder.erje.net!feeder.erje.net!2.us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news.unit0.net!news.panservice.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Waiman Long <longman@redhat.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH v4 19/20] sched, TP-futex: Make wake_up_q() return wakeup count |
| Date | Thu, 29 Dec 2016 17:20:01 +0100 |
| Message-ID | <sTLAR-pI-1@gated-at.bofh.it> (permalink) |
| References | <sTLAR-pI-3@gated-at.bofh.it> |
| X-Original-To | Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Jonathan Corbet <corbet@lwn.net> |
| X-Scanned-By | MIMEDefang 2.68 on 10.5.11.26 |
| X-Greylist | Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 29 Dec 2016 16:14:42 +0000 (UTC) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 74 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Arnaldo Carvalho de Melo <acme@kernel.org>, Davidlohr Bueso <dave@stgolabs.net>, Mike Galbraith <umgwanakikbuti@gmail.com>, Scott J Norton <scott.norton@hpe.com>, Waiman Long <longman@redhat.com> |
| X-Original-Date | Thu, 29 Dec 2016 11:13:45 -0500 |
| X-Original-Message-ID | <1483028026-10305-20-git-send-email-longman@redhat.com> |
| X-Original-References | <1483028026-10305-1-git-send-email-longman@redhat.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1548139 |
Show key headers only | View raw
Unlike wake_up_process(), wake_up_q() doesn't tell us how many
tasks have been woken up. This information can sometimes be useful
for tracking purpose. So wake_up_q() is now modified to return that
information.
Signed-off-by: Waiman Long <longman@redhat.com>
---
include/linux/sched.h | 2 +-
kernel/futex.c | 8 +++-----
kernel/sched/core.c | 6 ++++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 453143c..eeb6d5a 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1038,7 +1038,7 @@ struct wake_q_head {
extern void wake_q_add(struct wake_q_head *head,
struct task_struct *task);
-extern void wake_up_q(struct wake_q_head *head);
+extern int wake_up_q(struct wake_q_head *head);
/*
* sched-domains (multiprocessor balancing) declarations:
diff --git a/kernel/futex.c b/kernel/futex.c
index 5e69c44..4f235e8 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -4254,11 +4254,9 @@ static int futex_unlock(u32 __user *uaddr, unsigned int flags,
out_put_key:
put_futex_key(&key);
if (owner) {
- /*
- * No error would have happened if owner defined.
- */
- wake_up_q(&wake_q);
- return ret ? ret : 1;
+ int cnt = wake_up_q(&wake_q);
+
+ return ret ? ret : cnt;
}
return ret;
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 966556e..eed7a15 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -449,9 +449,10 @@ void wake_q_add(struct wake_q_head *head, struct task_struct *task)
head->lastp = &node->next;
}
-void wake_up_q(struct wake_q_head *head)
+int wake_up_q(struct wake_q_head *head)
{
struct wake_q_node *node = head->first;
+ int wakecnt = 0;
while (node != WAKE_Q_TAIL) {
struct task_struct *task;
@@ -466,9 +467,10 @@ void wake_up_q(struct wake_q_head *head)
* wake_up_process() implies a wmb() to pair with the queueing
* in wake_q_add() so as not to miss wakeups.
*/
- wake_up_process(task);
+ wakecnt += wake_up_process(task);
put_task_struct(task);
}
+ return wakecnt;
}
/*
--
1.8.3.1
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH v4 19/20] sched, TP-futex: Make wake_up_q() return wakeup count Waiman Long <longman@redhat.com> - 2016-12-29 17:20 +0100
csiph-web