Re: [PATCH 1/4] s390/crypto: Replace cond_resched() with schedule()
From: Heiko Carstens
Date: Tue Jul 28 2026 - 08:15:21 EST
On Tue, Jul 28, 2026 at 11:51:04AM +0200, Holger Dengler wrote:
> On 7/28/26 10:29, Heiko Carstens wrote:
> > Well, the main question still remains: why did the code use cond_resched()?
> >
> > This doesn't make sense to me, at least when reading the comment. So to me
> > even the schedule() approach I proposed is questionable. Why didn't the code
> > use msleep() instead? Or can we just remove cond_resched() entirely without
> > any replacement?
>
> As the comment says, if possible, the scheduler should run any other
> workload in case of a -EKEYEXPIRED, as the re-creation of the protected key
> is in progress.
>
> My current understanding was (and still is), that cond_resched() (or even
> schedule()) is doing exactly that: give back the control to the scheduler.
This is not the case, and never was (maybe it was for schedule() before CFS,
but that's history). See also Peter's reply.
> If this is not the case, but msleep() is doing the trick, I would vote for
> msleep().
Ok, then I change cond_resched() to msleep(1).