Re: [PATCH v3 4/6] sched/completion: Add wait_for_completion_state()

From: Peter Zijlstra
Date: Fri Aug 26 2022 - 17:54:58 EST


On Tue, Aug 23, 2022 at 07:32:33PM +0200, Rafael J. Wysocki wrote:
> On Mon, Aug 22, 2022 at 1:48 PM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > Allows waiting with a custom @state.
> >
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> > ---
> > include/linux/completion.h | 1 +
> > kernel/sched/completion.c | 9 +++++++++
> > 2 files changed, 10 insertions(+)
> >
> > --- a/include/linux/completion.h
> > +++ b/include/linux/completion.h
> > @@ -103,6 +103,7 @@ extern void wait_for_completion(struct c
> > extern void wait_for_completion_io(struct completion *);
> > extern int wait_for_completion_interruptible(struct completion *x);
> > extern int wait_for_completion_killable(struct completion *x);
> > +extern int wait_for_completion_state(struct completion *x, unsigned int state);
> > extern unsigned long wait_for_completion_timeout(struct completion *x,
> > unsigned long timeout);
> > extern unsigned long wait_for_completion_io_timeout(struct completion *x,
> > --- a/kernel/sched/completion.c
> > +++ b/kernel/sched/completion.c
> > @@ -247,6 +247,15 @@ int __sched wait_for_completion_killable
> > }
> > EXPORT_SYMBOL(wait_for_completion_killable);
> >
> > +int __sched wait_for_completion_state(struct completion *x, unsigned int state)
> > +{
> > + long t = wait_for_common(x, MAX_SCHEDULE_TIMEOUT, state);
> > + if (t == -ERESTARTSYS)
> > + return t;
> > + return 0;
> > +}
> > +EXPORT_SYMBOL(wait_for_completion_state);
>
> Why not EXPORT_SYMBOL_GPL? I guess to match the above?

Yeah; I'm torn between preference and consistency here :-)