sched/completion: Expose wait_for_common*() to drivers

Allow drivers to wait with a custom task state specified by exposing the
raw wait_for_common*() functions. This allows code to wait for completions
that are invariant with respect to CPU performance *without* contributing
to load avg, without requiring the wait to be interruptible.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
This commit is contained in:
Sultan Alsawaf 2023-11-16 21:03:11 -08:00 committed by Ksawlii
parent 15898055b7
commit 669f8aa664
2 changed files with 4 additions and 2 deletions

View file

@ -100,6 +100,8 @@ static inline void reinit_completion(struct completion *x)
x->done = 0;
}
extern long wait_for_common(struct completion *x, long timeout, int state);
extern long wait_for_common_io(struct completion *x, long timeout, int state);
extern void wait_for_completion(struct completion *);
extern void wait_for_completion_io(struct completion *);
extern int wait_for_completion_interruptible(struct completion *x);

View file

@ -111,13 +111,13 @@ __wait_for_common(struct completion *x,
return timeout;
}
static long __sched
long __sched
wait_for_common(struct completion *x, long timeout, int state)
{
return __wait_for_common(x, schedule_timeout, timeout, state);
}
static long __sched
long __sched
wait_for_common_io(struct completion *x, long timeout, int state)
{
return __wait_for_common(x, io_schedule_timeout, timeout, state);