Sleeping after preempt_disable() possible?

Sleeping after preempt_disable() possible?

am 01.09.2006 07:24:19 von Rick Brown

Can I sleep after a call to preempt_disable() ?

Thanks,

Rick
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

Re: Sleeping after preempt_disable() possible?

am 01.09.2006 14:46:27 von bora.sahin

> Can I sleep after a call to preempt_disable() ?

What are you trying to do? You can sleep from process context. If two
different process context can access to shared data, you can use semaphore...


--
Bora SAHIN
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

Re: Sleeping after preempt_disable() possible?

am 01.09.2006 15:21:15 von Rick Brown

>
> > Can I sleep after a call to preempt_disable() ?
>
> What are you trying to do? You can sleep from process context. If two
> different process context can access to shared data, you can use semaphore...
>

I was curious that after a call to preempt_disable(), can I call a
function that MAY sleep?
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

Re: Sleeping after preempt_disable() possible?

am 01.09.2006 16:13:45 von Octavian Purdila

On Friday 01 September 2006 16:21, Rick Brown wrote:
> > > Can I sleep after a call to preempt_disable() ?
> >
> > What are you trying to do? You can sleep from process context. If two
> > different process context can access to shared data, you can use
> > semaphore...
>
> I was curious that after a call to preempt_disable(), can I call a
> function that MAY sleep?
>

No, you are not allowed to sleep with preemption disabled.


tavi
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

Re: Sleeping after preempt_disable() possible?

am 02.09.2006 01:56:37 von Rik van Riel

Rick Brown wrote:

> I was curious that after a call to preempt_disable(), can I call a
> function that MAY sleep?

Bad idea. That can make the kernel do bad things...

Just take a look at schedule() in kernel/sched.c:

asmlinkage void __sched schedule(void)
{
....
if (unlikely(in_atomic() && !current->exit_state)) {
printk(KERN_ERR "BUG: scheduling while atomic: "
"%s/0x%08x/%d\n",
current->comm, preempt_count(), current->pid);
dump_stack();
}

Of course, in_atomic() checks whether you disabled preemption.

--
What is important? What you want to be true, or what is true?

--
VGER BF report: H 1.11022e-16
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs