Re: [PATCH v3 1/2] mmc: Move mmc_delay() to include/linux/mmc/core.h

From
Chunhe Lan <hidden>
Date
2012-09-24 03:18:24
Also in
linux-mmc
Reply to
Arnd Bergmann, 2012-09-21
On 09/21/2012 08:33 AM, Arnd Bergmann wrote:
On Friday 21 September 2012, Chunhe Lan wrote:
quoted
On 08/10/2012 09:27 AM, Arnd Bergmann wrote:
quoted
On Friday 10 August 2012, Chunhe Lan wrote:

       cond_resched();
       mdelay(ms);

sets off alarm bells, and I would always replace that with msleep().
      I think that it does not replace with msleep().
      When the time of sleep is very short, program should not been scheduled
      in the context. Because it expends the more time.
A time measured in miliseconds is never "very short" for the scheduler,
a lot of things can happen during that time span. The code I quoted
also does not care too much about accuracy, otherwise it would adapt
the time in the mdelay based on whether the cond_resched() actually
schedules to another thread.
   OK. As you have mentioned, it would been modified to such:

static inline void mmc_delay(unsigned int ms)
{
        if (ms < 1000 / HZ) {
                cond_resched();
                msleep(ms);
        } else {
                msleep(ms);
        }
}

OR such:

static inline void mmc_delay(unsigned int ms)
{
                msleep(ms);
}

OR other code?

Thanks,
Chunhe
	Arnd
Thread (7 messages) 7 messages, 4 authors, last reply 2012-09-24
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help