lkml.org 
[lkml]   [2002]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] schedule() in_atomic() fix
From
Date
On Wed, 2002-09-18 at 01:05, Andrew Morton wrote:

> Robert Love wrote:
> >
> > + printk(KERN_ERR "scheduling while non-atomic!\n");
>
> When did this become illegal? :-)

Ugh, reality is blurred... thanks.

Linus, this patch reduces the kernel by 4 bytes over the previous.
Please, apply.

Robert Love

diff -urN linux-2.5.36/kernel/sched.c linux/kernel/sched.c
--- linux-2.5.36/kernel/sched.c Tue Sep 17 20:58:48 2002
+++ linux/kernel/sched.c Wed Sep 18 00:41:09 2002
@@ -940,9 +940,6 @@
struct list_head *queue;
int idx;

- if (unlikely(in_atomic()))
- BUG();
-
#if CONFIG_DEBUG_HIGHMEM
check_highmem_ptes();
#endif
@@ -950,8 +947,20 @@
preempt_disable();
prev = current;
rq = this_rq();
-
release_kernel_lock(prev);
+
+ /*
+ * Test if we are atomic. Since do_exit() needs to call into
+ * schedule() atomically, we ignore that for now. Otherwise,
+ * whine if we are scheduling when we should not be.
+ */
+ if (likely(current->state != TASK_ZOMBIE)) {
+ if (unlikely((preempt_count() & ~PREEMPT_ACTIVE) != 1)) {
+ printk(KERN_ERR "scheduling while atomic!\n");
+ dump_stack();
+ }
+ }
+
prev->sleep_timestamp = jiffies;
spin_lock_irq(&rq->lock);


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

\
 
 \ /
  Last update: 2005-03-22 12:52    [W:0.033 / U:2.056 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site