[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231109093836.42a0e006@xps-13>
Date: Thu, 9 Nov 2023 09:38:36 +0100
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Matthew Wilcox <willy@...radead.org>,
Ankur Arora <ankur.a.arora@...cle.com>,
linux-kernel@...r.kernel.org, tglx@...utronix.de,
peterz@...radead.org, torvalds@...ux-foundation.org,
paulmck@...nel.org, linux-mm@...ck.org, x86@...nel.org,
akpm@...ux-foundation.org, luto@...nel.org, bp@...en8.de,
dave.hansen@...ux.intel.com, hpa@...or.com, mingo@...hat.com,
juri.lelli@...hat.com, vincent.guittot@...aro.org, mgorman@...e.de,
jon.grimm@....com, bharata@....com, raghavendra.kt@....com,
boris.ostrovsky@...cle.com, konrad.wilk@...cle.com,
jgross@...e.com, andrew.cooper3@...rix.com, mingo@...nel.org,
bristot@...nel.org, mathieu.desnoyers@...icios.com,
geert@...ux-m68k.org, glaubitz@...sik.fu-berlin.de,
anton.ivanov@...bridgegreys.com, mattst88@...il.com,
krypton@...ich-teichert.org, David.Laight@...lab.com,
richard@....at, mjguzik@...il.com,
Vignesh Raghavendra <vigneshr@...com>,
Kyungmin Park <kyungmin.park@...sung.com>,
Tudor Ambarus <tudor.ambarus@...aro.org>,
Pratyush Yadav <pratyush@...nel.org>
Subject: Re: [RFC PATCH 82/86] treewide: mtd: remove cond_resched()
Hello,
rostedt@...dmis.org wrote on Wed, 8 Nov 2023 12:21:16 -0500:
> On Wed, 8 Nov 2023 16:32:36 +0000
> Matthew Wilcox <willy@...radead.org> wrote:
>
> > 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.
Well, I think I'm aligned with the change and the first sentence in the
comment, but not with the second sentence which I find not relevant.
Maybe I don't understand what "maybe this should timeout" and Ankur
meant "sleeping" there, but for me a timeout is when you bail out with
an error. If sleeping is advised, then why not using a more explicit
wording? As for hardware events, in this case it is not relevant, as
you noticed, so I asked this part of the sentence to be dropped.
This is a legacy part of the core but is still part of the core. In
general I don't mind treewide changes to be slightly generic and I will
not be bothered too much with the device drivers changes, but the core
is more important to my eyes.
> Oh how I wish we could bring back the old PREEMPT_RT cpu_chill()...
>
> #define cpu_chill() msleep(1)
:')
Thanks,
Miquèl
Powered by blists - more mailing lists