All of lore.kernel.org
 help / color / mirror / Atom feed
* Sleeping after preempt_disable() possible?
@ 2006-09-01  5:24 Rick Brown
  2006-09-01 12:46 ` bora.sahin
  0 siblings, 1 reply; 5+ messages in thread
From: Rick Brown @ 2006-09-01  5:24 UTC (permalink / raw)
  To: kernelnewbies, linux-newbie

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sleeping after preempt_disable() possible?
  2006-09-01  5:24 Sleeping after preempt_disable() possible? Rick Brown
@ 2006-09-01 12:46 ` bora.sahin
  2006-09-01 13:21   ` Rick Brown
  0 siblings, 1 reply; 5+ messages in thread
From: bora.sahin @ 2006-09-01 12:46 UTC (permalink / raw)
  To: kernelnewbies; +Cc: Rick Brown, linux-newbie


> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sleeping after preempt_disable() possible?
  2006-09-01 12:46 ` bora.sahin
@ 2006-09-01 13:21   ` Rick Brown
  2006-09-01 14:13     ` Octavian Purdila
  2006-09-01 23:56     ` Rik van Riel
  0 siblings, 2 replies; 5+ messages in thread
From: Rick Brown @ 2006-09-01 13:21 UTC (permalink / raw)
  To: bora.sahin@ttnet.net.tr; +Cc: kernelnewbies, linux-newbie

>
> > 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sleeping after preempt_disable() possible?
  2006-09-01 13:21   ` Rick Brown
@ 2006-09-01 14:13     ` Octavian Purdila
  2006-09-01 23:56     ` Rik van Riel
  1 sibling, 0 replies; 5+ messages in thread
From: Octavian Purdila @ 2006-09-01 14:13 UTC (permalink / raw)
  To: kernelnewbies; +Cc: Rick Brown, bora.sahin@ttnet.net.tr, linux-newbie

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sleeping after preempt_disable() possible?
  2006-09-01 13:21   ` Rick Brown
  2006-09-01 14:13     ` Octavian Purdila
@ 2006-09-01 23:56     ` Rik van Riel
  1 sibling, 0 replies; 5+ messages in thread
From: Rik van Riel @ 2006-09-01 23:56 UTC (permalink / raw)
  To: Rick Brown; +Cc: bora.sahin@ttnet.net.tr, kernelnewbies, linux-newbie

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-09-01 23:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-01  5:24 Sleeping after preempt_disable() possible? Rick Brown
2006-09-01 12:46 ` bora.sahin
2006-09-01 13:21   ` Rick Brown
2006-09-01 14:13     ` Octavian Purdila
2006-09-01 23:56     ` Rik van Riel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.