[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.1005241129500.1745@cobra.newdream.net>
Date: Mon, 24 May 2010 11:35:48 -0700 (PDT)
From: Sage Weil <sage@...dream.net>
To: linux-kernel@...r.kernel.org, mingo@...e.hu, peterz@...radead.org,
andreas.herrmann3@....com, tglx@...utronix.de, efault@....de
Subject: [PATCH] sched: add wait_for_completion_killable_timeout
Hi guys,
I need this patch (or something similar) to fix an issue with the way Ceph
is waiting for MDS requests to complete. I'm assuming there's no specific
reason the _killable_timeout variant was excluded? Can this go into .35?
Thanks-
sage
---
>From 1ae82e511ba1664691380ea5c630a94eec370166 Mon Sep 17 00:00:00 2001
From: Sage Weil <sage@...dream.net>
Date: Mon, 24 May 2010 11:12:42 -0700
Subject: [PATCH] sched: add wait_for_completion_killable_timeout
Add missing _killable_timeout variant for wait_for_completion that will
return when a timeout expires or the task is killed.
CC: Ingo Molnar <mingo@...e.hu>
CC: Peter Zijlstra <peterz@...radead.org>
CC: Andreas Herrmann <andreas.herrmann3@....com>
CC: Thomas Gleixner <tglx@...utronix.de>
CC: Mike Galbraith <efault@....de>
Signed-off-by: Sage Weil <sage@...dream.net>
---
include/linux/completion.h | 2 ++
kernel/sched.c | 17 +++++++++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 4a6b604..51e3145 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -83,6 +83,8 @@ extern unsigned long wait_for_completion_timeout(struct completion *x,
unsigned long timeout);
extern unsigned long wait_for_completion_interruptible_timeout(
struct completion *x, unsigned long timeout);
+extern unsigned long wait_for_completion_killable_timeout(
+ struct completion *x, unsigned long timeout);
extern bool try_wait_for_completion(struct completion *x);
extern bool completion_done(struct completion *x);
diff --git a/kernel/sched.c b/kernel/sched.c
index 3c2a54f..4d051c7 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4161,6 +4161,23 @@ int __sched wait_for_completion_killable(struct completion *x)
EXPORT_SYMBOL(wait_for_completion_killable);
/**
+ * wait_for_completion_killable_timeout: - waits for completion of a task (w/(to,killable))
+ * @x: holds the state of this particular completion
+ * @timeout: timeout value in jiffies
+ *
+ * This waits for either a completion of a specific task to be
+ * signaled or for a specified timeout to expire. It can be
+ * interrupted by a kill signal. The timeout is in jiffies.
+ */
+unsigned long __sched
+wait_for_completion_killable_timeout(struct completion *x,
+ unsigned long timeout)
+{
+ return wait_for_common(x, timeout, TASK_KILLABLE);
+}
+EXPORT_SYMBOL(wait_for_completion_killable_timeout);
+
+/**
* try_wait_for_completion - try to decrement a completion without blocking
* @x: completion structure
*
--
1.7.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists