aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/completion.h2
-rw-r--r--kernel/sched.c12
2 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 33d6aaf94447..5b55e972be2c 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -51,7 +51,7 @@ extern unsigned long wait_for_completion_interruptible_timeout(
51 51
52extern void complete(struct completion *); 52extern void complete(struct completion *);
53extern void complete_all(struct completion *); 53extern void complete_all(struct completion *);
54 54extern void complete_n(struct completion *, int n);
55#define INIT_COMPLETION(x) ((x).done = 0) 55#define INIT_COMPLETION(x) ((x).done = 0)
56 56
57#endif 57#endif
diff --git a/kernel/sched.c b/kernel/sched.c
index 09b529cf2bd8..c7d7d535288a 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3923,6 +3923,18 @@ void complete_all(struct completion *x)
3923} 3923}
3924EXPORT_SYMBOL(complete_all); 3924EXPORT_SYMBOL(complete_all);
3925 3925
3926void complete_n(struct completion *x, int n)
3927{
3928 unsigned long flags;
3929
3930 spin_lock_irqsave(&x->wait.lock, flags);
3931 x->done += n;
3932 __wake_up_common(&x->wait, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE,
3933 n, 0, NULL);
3934 spin_unlock_irqrestore(&x->wait.lock, flags);
3935}
3936EXPORT_SYMBOL(complete_n);
3937
3926static inline long __sched 3938static inline long __sched
3927do_wait_for_common(struct completion *x, long timeout, int state) 3939do_wait_for_common(struct completion *x, long timeout, int state)
3928{ 3940{