Re: [PATCH 19/31] swim: Deduplicate polling loops

From: Finn Thain

Date: Sun Jul 26 2026 - 20:19:34 EST



On Sun, 26 Jul 2026, Laurent Vivier wrote:

> > @@ -373,19 +364,8 @@ static inline void swim_head(struct swim __iomem *base,
> > enum head head)
> >
> > static inline int swim_step(struct swim __iomem *base)
> > {
> > - int wait;
> > -
> > swim_action(base, STEP);
> > -
> > - for (wait = 0; wait < HZ; wait++) {
> > -
> > - set_current_state(TASK_INTERRUPTIBLE);
> > - schedule_timeout(1);
> > -
> > - if (!swim_readbit(base, STEP))
> > - return 0;
> > - }
> > - return -1;
> > + return swim_readbit_timeout_atomic(base, STEP, false, 20 * 1000);
>
> I don't understand why we need _atomic() here.
>

You're right, it's not needed. This change used to take place before the
change from spinlock to mutex, but patches were re-arranged and its not
relevant now. I will address this in v2.