* preempt_disable and sleep()
@ 2010-05-13 18:32 ratheesh k
2010-05-13 18:43 ` Sven-Thorsten Dietrich
0 siblings, 1 reply; 4+ messages in thread
From: ratheesh k @ 2010-05-13 18:32 UTC (permalink / raw)
To: linux-kernel, linux-rt-users
I am running RT linux .
/* code snippet */
preempt_disable()
...........
sleep(10);
'............
preempt_enable()
will this sleep() will cause reschedule ?.
if an interrupt comes while premption is disabled , how it is handled ?.
Thanks,
Ratheesh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: preempt_disable and sleep()
2010-05-13 18:32 preempt_disable and sleep() ratheesh k
@ 2010-05-13 18:43 ` Sven-Thorsten Dietrich
2010-05-14 2:46 ` ratheesh k
0 siblings, 1 reply; 4+ messages in thread
From: Sven-Thorsten Dietrich @ 2010-05-13 18:43 UTC (permalink / raw)
To: ratheesh k; +Cc: linux-kernel, linux-rt-users
On Fri, 2010-05-14 at 00:02 +0530, ratheesh k wrote:
> I am running RT linux .
>
> /* code snippet */
>
> preempt_disable()
> ...........
> sleep(10);
> '............
> preempt_enable()
>
>
> will this sleep() will cause reschedule ?.
>
Why would you do this?
If you had tried this code, you would have seen the corresponding stack
dump on the console.
> if an interrupt comes while premption is disabled , how it is handled ?.
>
Depends on the number of (idle) cores, the setting of CONFIG_PREEMPT_[]
and the type of interrupt.
RT threaded IRQs would not run until preemption is enabled on a single
core system.
> Thanks,
> Ratheesh
> --
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: preempt_disable and sleep()
2010-05-13 18:43 ` Sven-Thorsten Dietrich
@ 2010-05-14 2:46 ` ratheesh k
2010-05-14 3:37 ` Paul E. McKenney
0 siblings, 1 reply; 4+ messages in thread
From: ratheesh k @ 2010-05-14 2:46 UTC (permalink / raw)
To: Sven-Thorsten Dietrich; +Cc: linux-kernel, linux-rt-users
On Fri, May 14, 2010 at 12:13 AM, Sven-Thorsten Dietrich
<thebigcorporation@gmail.com> wrote:
> Why would you do this?
I was reading some linux kernel journel about preempt_disable() . This
a doubt came to me .
> If you had tried this code, you would have seen the corresponding stack
> dump on the console.
Why it so .? could you explain a little more ? .sleep() will schedule
() , which inturn give back control to kernel .
Thank,
Ratheesh
On Fri, May 14, 2010 at 12:13 AM, Sven-Thorsten Dietrich
<thebigcorporation@gmail.com> wrote:
> On Fri, 2010-05-14 at 00:02 +0530, ratheesh k wrote:
>> I am running RT linux .
>>
>> /* code snippet */
>>
>> preempt_disable()
>> ...........
>> sleep(10);
>> '............
>> preempt_enable()
>>
>>
>> will this sleep() will cause reschedule ?.
>>
>
> Why would you do this?
>
> If you had tried this code, you would have seen the corresponding stack
> dump on the console.
>
>> if an interrupt comes while premption is disabled , how it is handled ?.
>>
>
> Depends on the number of (idle) cores, the setting of CONFIG_PREEMPT_[]
> and the type of interrupt.
>
> RT threaded IRQs would not run until preemption is enabled on a single
> core system.
>
>
>
>> Thanks,
>> Ratheesh
>> --
>> 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
>
>
>
--
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: preempt_disable and sleep()
2010-05-14 2:46 ` ratheesh k
@ 2010-05-14 3:37 ` Paul E. McKenney
0 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2010-05-14 3:37 UTC (permalink / raw)
To: ratheesh k; +Cc: Sven-Thorsten Dietrich, linux-kernel, linux-rt-users
On Fri, May 14, 2010 at 08:16:07AM +0530, ratheesh k wrote:
> On Fri, May 14, 2010 at 12:13 AM, Sven-Thorsten Dietrich
> <thebigcorporation@gmail.com> wrote:
>
> > Why would you do this?
> I was reading some linux kernel journel about preempt_disable() . This
> a doubt came to me .
>
>
> > If you had tried this code, you would have seen the corresponding stack
> > dump on the console.
>
>
> Why it so .? could you explain a little more ? .sleep() will schedule
> () , which inturn give back control to kernel .
Sleeping in the kernel with preemption disabled is considered to be a
bug. So the scheduler will print an error and a stack dump when this
happens.
In contrast, it is OK to do the following:
preempt_disable();
do_something();
preempt_enable();
schedule();
preempt_disable();
do_something_else();
preempt_enable();
Thanx, Paul
> Thank,
> Ratheesh
>
> On Fri, May 14, 2010 at 12:13 AM, Sven-Thorsten Dietrich
> <thebigcorporation@gmail.com> wrote:
> > On Fri, 2010-05-14 at 00:02 +0530, ratheesh k wrote:
> >> I am running RT linux .
> >>
> >> /* code snippet */
> >>
> >> preempt_disable()
> >> ...........
> >> sleep(10);
> >> '............
> >> preempt_enable()
> >>
> >>
> >> will this sleep() will cause reschedule ?.
> >>
> >
> > Why would you do this?
> >
> > If you had tried this code, you would have seen the corresponding stack
> > dump on the console.
> >
> >> if an interrupt comes while premption is disabled , how it is handled ?.
> >>
> >
> > Depends on the number of (idle) cores, the setting of CONFIG_PREEMPT_[]
> > and the type of interrupt.
> >
> > RT threaded IRQs would not run until preemption is enabled on a single
> > core system.
> >
> >
> >
> >> Thanks,
> >> Ratheesh
> >> --
> >> 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
> >
> >
> >
> --
> 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
--
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-05-14 3:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-13 18:32 preempt_disable and sleep() ratheesh k
2010-05-13 18:43 ` Sven-Thorsten Dietrich
2010-05-14 2:46 ` ratheesh k
2010-05-14 3:37 ` Paul E. McKenney
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).