]> git.hungrycats.org Git - linux/commitdiff
[PATCH] set TASK_RUNNING in cond_resched()
authorAndrew Morton <akpm@zip.com.au>
Thu, 4 Jul 2002 15:30:54 +0000 (08:30 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Thu, 4 Jul 2002 15:30:54 +0000 (08:30 -0700)
do_select() does set_current_state(TASK_INTERRUPTIBLE) then calls
__pollwait() which calls __get_free_page() and the cond_resched() which
I added to the pagecache reclaim code never returns.

The patch makes cond_resched() more useful by setting current->state to
TASK_RUNNING before scheduling.

include/linux/sched.h
kernel/ksyms.c
kernel/sched.c

index 90fb402ee8025b0259739156edd21b5a1b959483..9b5af2cc11d2562185b558721eba4136c7954a09 100644 (file)
@@ -837,10 +837,11 @@ static inline int need_resched(void)
        return unlikely(test_thread_flag(TIF_NEED_RESCHED));
 }
 
+extern void __cond_resched(void);
 static inline void cond_resched(void)
 {
        if (need_resched())
-               schedule();
+               __cond_resched();
 }
 
 /* Reevaluate whether the task has signals pending delivery.
index d2d6fe4794cc9c4acd07913ac4288417fd46c854..e88333d0c08be50b8e49dbcc8269df63e6e4537f 100644 (file)
@@ -473,6 +473,7 @@ EXPORT_SYMBOL(preempt_schedule);
 #endif
 EXPORT_SYMBOL(schedule_timeout);
 EXPORT_SYMBOL(sys_sched_yield);
+EXPORT_SYMBOL(__cond_resched);
 EXPORT_SYMBOL(set_user_nice);
 EXPORT_SYMBOL(task_nice);
 EXPORT_SYMBOL_GPL(idle_cpu);
index da94159d64262264321158e528888e5e26bd9251..11ede675025f5e80b61fe76287a9ef10aa15ff95 100644 (file)
@@ -1447,6 +1447,12 @@ asmlinkage long sys_sched_yield(void)
        return 0;
 }
 
+void __cond_resched(void)
+{
+       set_current_state(TASK_RUNNING);
+       schedule();
+}
+
 asmlinkage long sys_sched_get_priority_max(int policy)
 {
        int ret = -EINVAL;