linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: yi li <liyi.dev@gmail.com>
To: Gregory Haskins <ghaskins@novell.com>
Cc: linux-rt-users@vger.kernel.org
Subject: Re: A question about cpu_idle()
Date: Fri, 23 Oct 2009 00:24:24 +0800	[thread overview]
Message-ID: <a0e7fce50910220924s4b640cbi51af6d7e791e98e9@mail.gmail.com> (raw)
In-Reply-To: <4AE019210200005A00057226@sinclair.provo.novell.com>

On Thu, Oct 22, 2009 at 8:34 PM, Gregory Haskins <ghaskins@novell.com> wrote:
> Yes, that is right.  irq_disable is a effective superset of preempt-disable() in this context because it also blocks those RESCHED_IPI events from being received.  Of course, disabling interrupts also has other side effects since it also disables *all* interrupts (like timers, etc) so it should be used sparingly.  In this case, we are simply bridging the preempt_enable_no_resched() and schedule() to make sure it is truly an atomic transition to a sleep state, so its use is justified.
>
> I hope this helps, and feel free to ask any more questions you wish.

Thanks. Yes it make sense to me.

Another question may be basic - but I just cannot figure out.

Why PREEMPT_RT patch disables local irq (with local_irq_disable())
before __schedule()? Is it to ensure atomic excution of __schedule()?
If so, does that mean, linux kernel without PREEMPT_RT patch suffers
from racy problem in schedule()?

asmlinkage void __sched schedule(void)
{
  need_resched:
         local_irq_disable();
         __schedule();
         local_irq_enable();

        if (need_resched())
                goto need_resched;
}

I saw similiar code in preempt_schedule(), __cond_schedule() and
preempt_schedule_irq().

Regards,
-Yi
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2009-10-22 16:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-21  3:07 A question about cpu_idle() yi li
2009-10-21  4:47 ` Gregory Haskins
2009-10-22  4:30   ` yi li
2009-10-22 12:34     ` Gregory Haskins
2009-10-22 16:24       ` yi li [this message]
2009-10-22 18:59         ` Gregory Haskins
2009-10-24 10:04           ` yi li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a0e7fce50910220924s4b640cbi51af6d7e791e98e9@mail.gmail.com \
    --to=liyi.dev@gmail.com \
    --cc=ghaskins@novell.com \
    --cc=linux-rt-users@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).