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

Finn Thain <[email protected]> Mon, 27 Jul 2026 10:19:32 +1000 (AEST)
Newsgroups org.kernel.vger.linux-m68k,org.kernel.vger.linux-block,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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.