mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Question on Schedule and Preemption
@ 2006-04-18  7:23 Liu haixiang
  2006-04-18  9:17 ` Andreas Mohr
  0 siblings, 1 reply; 10+ messages in thread
From: Liu haixiang @ 2006-04-18  7:23 UTC (permalink / raw)
  To: linux-kernel

Hi All,

Now I am developing the driver on Linux kernel 2.6.11. And I met the
problem that kernel will dump my stack from time to time. And the
kernel log will give me messages like "scheduling while atomic: ...".

Then I found the code in sched.c:

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

Anybody can explain above code for me?

Thanks

best regards

Haixiang Liu

^ permalink raw reply	[flat|nested] 10+ messages in thread
* RE: Question on Schedule and Preemption
@ 2006-04-18 13:31 Michael Guo
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Guo @ 2006-04-18 13:31 UTC (permalink / raw)
  To: Liu haixiang, linux-kernel

Hi,
 The comments above the piece of code give some hints about the sane checking. When call "schedule" for process scheduling, make sure that context isn't atomic. That is, schedule should be called in a safe place such as spinlock free etc. And you can also read do_exit() code to get more detailed information.


   

-----Original Message-----
From: linux-kernel-owner@vger.kernel.org
[mailto:linux-kernel-owner@vger.kernel.org]On Behalf Of Liu haixiang
Sent: Tuesday, April 18, 2006 3:23 AM
To: linux-kernel@vger.kernel.org
Subject: Question on Schedule and Preemption


Hi All,

Now I am developing the driver on Linux kernel 2.6.11. And I met the
problem that kernel will dump my stack from time to time. And the
kernel log will give me messages like "scheduling while atomic: ...".

Then I found the code in sched.c:

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

Anybody can explain above code for me?

Thanks

best regards

Haixiang Liu
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" 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.tux.org/lkml/

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Question on Schedule and Preemption
@ 2006-04-18  7:12 Liu haixiang
  0 siblings, 0 replies; 10+ messages in thread
From: Liu haixiang @ 2006-04-18  7:12 UTC (permalink / raw)
  To: linux-kernel

Hi All,

Now I am developing drivers on Linux 2.6.

My problem is that from time to time, I will get log meesage from
kernel: "scheduling while atomic ..." and the stack will be dumped by
the kernel.

Then I investigate the code in sched.c but don't understand. Anybody
can clarify this piece of code for me?

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

Thanks a lot

Haixiang

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

end of thread, other threads:[~2006-04-18 17:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-18  7:23 Question on Schedule and Preemption Liu haixiang
2006-04-18  9:17 ` Andreas Mohr
2006-04-18  9:23   ` Arjan van de Ven
2006-04-18  9:28     ` Andreas Mohr
2006-04-18 12:55   ` Liu haixiang
2006-04-18 14:56     ` Steven Rostedt
2006-04-18 17:21       ` Liu haixiang
2006-04-18 17:32         ` Steven Rostedt
  -- strict thread matches above, loose matches on Subject: below --
2006-04-18 13:31 Michael Guo
2006-04-18  7:12 Liu haixiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®