Re: Sleeping after preempt_disable() possible?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux