* [PATCH] sched: add wait_for_completion_killable_timeout
@ 2010-05-24 18:35 Sage Weil
2010-05-28 19:16 ` Sage Weil
0 siblings, 1 reply; 4+ messages in thread
From: Sage Weil @ 2010-05-24 18:35 UTC (permalink / raw
To: linux-kernel, mingo, peterz, andreas.herrmann3, tglx, efault
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@newdream.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@elte.hu>
CC: Peter Zijlstra <peterz@infradead.org>
CC: Andreas Herrmann <andreas.herrmann3@amd.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Mike Galbraith <efault@gmx.de>
Signed-off-by: Sage Weil <sage@newdream.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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] sched: add wait_for_completion_killable_timeout
2010-05-24 18:35 [PATCH] sched: add wait_for_completion_killable_timeout Sage Weil
@ 2010-05-28 19:16 ` Sage Weil
2010-05-29 10:44 ` Peter Zijlstra
0 siblings, 1 reply; 4+ messages in thread
From: Sage Weil @ 2010-05-28 19:16 UTC (permalink / raw
To: linux-kernel, mingo, peterz, andreas.herrmann3, tglx, efault; +Cc: akpm
Hi-
Do I need an ACK on this, or should I just send this to Linus with the
Ceph fix? It's a pretty trivial fixup.
Thanks-
sage
On Mon, 24 May 2010, Sage Weil wrote:
> 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@newdream.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@elte.hu>
> CC: Peter Zijlstra <peterz@infradead.org>
> CC: Andreas Herrmann <andreas.herrmann3@amd.com>
> CC: Thomas Gleixner <tglx@linutronix.de>
> CC: Mike Galbraith <efault@gmx.de>
> Signed-off-by: Sage Weil <sage@newdream.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
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sched: add wait_for_completion_killable_timeout
2010-05-28 19:16 ` Sage Weil
@ 2010-05-29 10:44 ` Peter Zijlstra
2010-05-29 16:15 ` Sage Weil
0 siblings, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2010-05-29 10:44 UTC (permalink / raw
To: Sage Weil; +Cc: linux-kernel, mingo, andreas.herrmann3, tglx, efault, akpm
On Fri, 2010-05-28 at 12:16 -0700, Sage Weil wrote:
> Hi-
>
> Do I need an ACK on this, or should I just send this to Linus with the
> Ceph fix? It's a pretty trivial fixup.
> > --- 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
> > *
I guess its ok, although I have an intrinsic suspicion of all things
timeout, but since we have plenty of those interfaces around I can't
object too much ;-)
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sched: add wait_for_completion_killable_timeout
2010-05-29 10:44 ` Peter Zijlstra
@ 2010-05-29 16:15 ` Sage Weil
0 siblings, 0 replies; 4+ messages in thread
From: Sage Weil @ 2010-05-29 16:15 UTC (permalink / raw
To: Peter Zijlstra; +Cc: linux-kernel, mingo, andreas.herrmann3, tglx, efault, akpm
On Sat, 29 May 2010, Peter Zijlstra wrote:
> On Fri, 2010-05-28 at 12:16 -0700, Sage Weil wrote:
> > Hi-
> >
> > Do I need an ACK on this, or should I just send this to Linus with the
> > Ceph fix? It's a pretty trivial fixup.
>
> > > --- 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
> > > *
>
> I guess its ok, although I have an intrinsic suspicion of all things
> timeout, but since we have plenty of those interfaces around I can't
> object too much ;-)
>
> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Agreed (about timeouts). In this case the timeout is only used during
mount so that we don't hang indefinitely if the server is unreachable.
Thanks :)
sage
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-05-29 16:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-24 18:35 [PATCH] sched: add wait_for_completion_killable_timeout Sage Weil
2010-05-28 19:16 ` Sage Weil
2010-05-29 10:44 ` Peter Zijlstra
2010-05-29 16:15 ` Sage Weil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).