All of lore.kernel.org
 help / color / mirror / Atom feed
* schedule while atomic
@ 2005-07-12 19:56 Brian O'Mahoney
  0 siblings, 0 replies; 2+ messages in thread
From: Brian O'Mahoney @ 2005-07-12 19:56 UTC (permalink / raw)
  To: Mateusz Berezecki, linux-kernel

More importantly _exactly_what_ are you using the LOCK to protect?

Short recap, spinlocks are used to serialise, ie prevent races in SMP
systems, where turning the interrupts off, on a single processor, is
NOT good enough to prevent races between interrupt-handlers and core
kernel code accessing shared-common-data eg managing a linked list
where the data structure would be mangled by shared access; thus
the lock should be taken and released _for_the_shortest_time_possible_
eg

get lock
unlink head of list
give lock

and so on, so get the lock only when you need it, and give it back as
soon as the transaction is done; also design the data-structure so that
complex, long lasting transactions are un-necessary.

see also RCU.

-- 
mit freundlichen Grüßen, Brian.



^ permalink raw reply	[flat|nested] 2+ messages in thread
* Schedule while atomic
@ 2006-05-06 11:56 Andreas Gaupmann
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Gaupmann @ 2006-05-06 11:56 UTC (permalink / raw)
  To: netfilter

Hello,

I have registered a callback function in a kernel module with the Netfilter 
hook NF_IP_LOCAL_IN. In the function the following statements lead to a 
kernel freeze:

set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ);

Another try (with the same result) for letting the hook function sleep for a 
certain amount of time:

while (time_before(jiffies,jiffies+HZ));

The error message for the kernel oops is "scheduling while atomic" for both 
attempts.

Why is this error ocurring? Are the Netfilter hooks atomic?
How can a sleep in a hook function be achieved?

Regards,
Andreas Gaupmann


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

end of thread, other threads:[~2006-05-06 11:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-12 19:56 schedule while atomic Brian O'Mahoney
  -- strict thread matches above, loose matches on Subject: below --
2006-05-06 11:56 Schedule " Andreas Gaupmann

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.