lkml.org 
[lkml]   [2023]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 82/86] treewide: mtd: remove cond_resched()
On Wed, Nov 08, 2023 at 05:28:27PM +0100, Miquel Raynal wrote:
> > --- a/drivers/mtd/nand/raw/nand_legacy.c
> > +++ b/drivers/mtd/nand/raw/nand_legacy.c
> > @@ -203,7 +203,13 @@ void nand_wait_ready(struct nand_chip *chip)
> > do {
> > if (chip->legacy.dev_ready(chip))
> > return;
> > - cond_resched();
> > + /*
> > + * Use a cond_resched_stall() to avoid spinning in
> > + * a tight loop.
> > + * Though, given that the timeout is in milliseconds,
> > + * maybe this should timeout or event wait?
>
> Event waiting is precisely what we do here, with the hardware access
> which are available in this case. So I believe this part of the comment
> (in general) is not relevant. Now regarding the timeout I believe it is
> closer to the second than the millisecond, so timeout-ing is not
> relevant either in most cases (talking about mtd/ in general).

I think you've misunderstood what Ankur wrote here. What you're
currently doing is spinning in a very tight loop. The comment is
suggesting you might want to msleep(1) or something to avoid burning CPU
cycles. It'd be even better if the hardware could signal you somehow,
but I bet it can't.

> > + */
> > + cond_resched_stall();
> > } while (time_before(jiffies, timeo));
>
> Thanks,
> Miquèl
>

\
 
 \ /
  Last update: 2023-11-20 13:53    [W:0.662 / U:0.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site