On Tue, Nov 05, 2019 at 08:43:06PM -0800, Darrick J. Wong wrote: > +++ b/fs/xfs/scrub/common.h > @@ -14,8 +14,20 @@ > static inline bool > xchk_should_terminate( > struct xfs_scrub *sc, > - int *error) > + int *error) > { > +#if !IS_ENABLED(CONFIG_PREEMPT) > + /* > + * If preemption is disabled, we need to yield to the scheduler every > + * few seconds so that we don't run afoul of the soft lockup watchdog > + * or RCU stall detector. > + */ > + if (sc->next_yield != 0 && time_after(jiffies, sc->next_yield)) > + return false; > + schedule(); > + sc->next_yield = jiffies + msecs_to_jiffies(5000); > +#endif This looks weird. Can't we just do a cond_resched() here?