Commit b5b6fa52 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] set TASK_RUNNING in yield()

It seems that the yield() macro requires state TASK_RUNNING, but
practically none of the callers remember to do that.

The patch turns yield() into a real function which sets state
TASK_RUNNING before scheduling.
parent b2bd3a26
......@@ -1031,14 +1031,6 @@ extern unsigned char e100_selftest(struct e100_private *bdp, u32 *st_timeout,
extern unsigned char e100_get_link_state(struct e100_private *bdp);
extern unsigned char e100_wait_scb(struct e100_private *bdp);
#ifndef yield
#define yield() \
do { \
current->policy |= SCHED_YIELD; \
schedule(); \
} while (0)
#endif
extern void e100_deisolate_driver(struct e100_private *bdp,
u8 recover, u8 full_reset);
extern unsigned char e100_hw_reset_recover(struct e100_private *bdp,
......
......@@ -494,7 +494,6 @@ static void free_more_memory(void)
wakeup_bdflush();
try_to_free_pages(zone, GFP_NOFS, 0);
blk_run_queues();
__set_current_state(TASK_RUNNING);
yield();
}
......
......@@ -418,8 +418,7 @@ extern int task_prio(task_t *p);
extern int task_nice(task_t *p);
extern int idle_cpu(int cpu);
asmlinkage long sys_sched_yield(void);
#define yield() sys_sched_yield()
void yield(void);
/*
* The default (Linux) execution domain.
......
......@@ -472,7 +472,7 @@ EXPORT_SYMBOL(schedule);
EXPORT_SYMBOL(preempt_schedule);
#endif
EXPORT_SYMBOL(schedule_timeout);
EXPORT_SYMBOL(sys_sched_yield);
EXPORT_SYMBOL(yield);
EXPORT_SYMBOL(__cond_resched);
EXPORT_SYMBOL(set_user_nice);
EXPORT_SYMBOL(task_nice);
......
......@@ -1453,6 +1453,12 @@ void __cond_resched(void)
schedule();
}
void yield(void)
{
set_current_state(TASK_RUNNING);
sys_sched_yield();
}
asmlinkage long sys_sched_get_priority_max(int policy)
{
int ret = -EINVAL;
......
......@@ -262,7 +262,6 @@ void tasklet_kill(struct tasklet_struct *t)
printk("Attempt to kill tasklet from interrupt\n");
while (test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) {
current->state = TASK_RUNNING;
do
yield();
while (test_bit(TASKLET_STATE_SCHED, &t->state));
......
......@@ -237,8 +237,7 @@ int freeze_processes(void)
todo++;
}
read_unlock(&tasklist_lock);
sys_sched_yield();
schedule();
yield();
if (time_after(jiffies, start_time + TIMEOUT)) {
PRINTK( "\n" );
printk(KERN_ERR " stopping tasks failed (%d tasks remaining)\n", todo );
......
......@@ -441,7 +441,6 @@ struct page * __alloc_pages(unsigned int gfp_mask, unsigned int order, zonelist_
goto nopage;
/* Yield for kswapd, and try again */
__set_current_state(TASK_RUNNING);
yield();
goto rebalance;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment