aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-09-14 13:55:44 -0400
committerIngo Molnar <mingo@elte.hu>2009-09-15 10:51:30 -0400
commit7d47872146398dbede13223299fe1cb368ebc781 (patch)
treec472424ecbabdb8136e2b93f49f75af9414f03f3 /kernel/sched.c
parent0763a660a84220cc3900fd32abdd7ad109e2278d (diff)
sched: Rename sync arguments
In order to extend the functions to have more than 1 flag (sync), rename the argument to flags, and explicitly define a WF_ space for individual flags. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index e8e603bf8761..4da335cec8ee 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -636,9 +636,10 @@ struct rq {
636 636
637static DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); 637static DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
638 638
639static inline void check_preempt_curr(struct rq *rq, struct task_struct *p, int sync) 639static inline
640void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags)
640{ 641{
641 rq->curr->sched_class->check_preempt_curr(rq, p, sync); 642 rq->curr->sched_class->check_preempt_curr(rq, p, flags);
642} 643}
643 644
644static inline int cpu_of(struct rq *rq) 645static inline int cpu_of(struct rq *rq)
@@ -2318,14 +2319,15 @@ void task_oncpu_function_call(struct task_struct *p,
2318 * 2319 *
2319 * returns failure only if the task is already active. 2320 * returns failure only if the task is already active.
2320 */ 2321 */
2321static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync) 2322static int try_to_wake_up(struct task_struct *p, unsigned int state,
2323 int wake_flags)
2322{ 2324{
2323 int cpu, orig_cpu, this_cpu, success = 0; 2325 int cpu, orig_cpu, this_cpu, success = 0;
2324 unsigned long flags; 2326 unsigned long flags;
2325 struct rq *rq; 2327 struct rq *rq;
2326 2328
2327 if (!sched_feat(SYNC_WAKEUPS)) 2329 if (!sched_feat(SYNC_WAKEUPS))
2328 sync = 0; 2330 wake_flags &= ~WF_SYNC;
2329 2331
2330 this_cpu = get_cpu(); 2332 this_cpu = get_cpu();
2331 2333
@@ -2352,7 +2354,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
2352 p->state = TASK_WAKING; 2354 p->state = TASK_WAKING;
2353 task_rq_unlock(rq, &flags); 2355 task_rq_unlock(rq, &flags);
2354 2356
2355 cpu = p->sched_class->select_task_rq(p, SD_BALANCE_WAKE, sync); 2357 cpu = p->sched_class->select_task_rq(p, SD_BALANCE_WAKE, wake_flags);
2356 if (cpu != orig_cpu) 2358 if (cpu != orig_cpu)
2357 set_task_cpu(p, cpu); 2359 set_task_cpu(p, cpu);
2358 2360
@@ -2378,7 +2380,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
2378out_activate: 2380out_activate:
2379#endif /* CONFIG_SMP */ 2381#endif /* CONFIG_SMP */
2380 schedstat_inc(p, se.nr_wakeups); 2382 schedstat_inc(p, se.nr_wakeups);
2381 if (sync) 2383 if (wake_flags & WF_SYNC)
2382 schedstat_inc(p, se.nr_wakeups_sync); 2384 schedstat_inc(p, se.nr_wakeups_sync);
2383 if (orig_cpu != cpu) 2385 if (orig_cpu != cpu)
2384 schedstat_inc(p, se.nr_wakeups_migrate); 2386 schedstat_inc(p, se.nr_wakeups_migrate);
@@ -2407,7 +2409,7 @@ out_activate:
2407 2409
2408out_running: 2410out_running:
2409 trace_sched_wakeup(rq, p, success); 2411 trace_sched_wakeup(rq, p, success);
2410 check_preempt_curr(rq, p, sync); 2412 check_preempt_curr(rq, p, wake_flags);
2411 2413
2412 p->state = TASK_RUNNING; 2414 p->state = TASK_RUNNING;
2413#ifdef CONFIG_SMP 2415#ifdef CONFIG_SMP
@@ -5562,10 +5564,10 @@ asmlinkage void __sched preempt_schedule_irq(void)
5562 5564
5563#endif /* CONFIG_PREEMPT */ 5565#endif /* CONFIG_PREEMPT */
5564 5566
5565int default_wake_function(wait_queue_t *curr, unsigned mode, int sync, 5567int default_wake_function(wait_queue_t *curr, unsigned mode, int flags,
5566 void *key) 5568 void *key)
5567{ 5569{
5568 return try_to_wake_up(curr->private, mode, sync); 5570 return try_to_wake_up(curr->private, mode, flags);
5569} 5571}
5570EXPORT_SYMBOL(default_wake_function); 5572EXPORT_SYMBOL(default_wake_function);
5571 5573
@@ -5579,14 +5581,14 @@ EXPORT_SYMBOL(default_wake_function);
5579 * zero in this (rare) case, and we handle it by continuing to scan the queue. 5581 * zero in this (rare) case, and we handle it by continuing to scan the queue.
5580 */ 5582 */
5581static void __wake_up_common(wait_queue_head_t *q, unsigned int mode, 5583static void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
5582 int nr_exclusive, int sync, void *key) 5584 int nr_exclusive, int flags, void *key)
5583{ 5585{
5584 wait_queue_t *curr, *next; 5586 wait_queue_t *curr, *next;
5585 5587
5586 list_for_each_entry_safe(curr, next, &q->task_list, task_list) { 5588 list_for_each_entry_safe(curr, next, &q->task_list, task_list) {
5587 unsigned flags = curr->flags; 5589 unsigned flags = curr->flags;
5588 5590
5589 if (curr->func(curr, mode, sync, key) && 5591 if (curr->func(curr, mode, flags, key) &&
5590 (flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive) 5592 (flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive)
5591 break; 5593 break;
5592 } 5594 }
@@ -5647,16 +5649,16 @@ void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode,
5647 int nr_exclusive, void *key) 5649 int nr_exclusive, void *key)
5648{ 5650{
5649 unsigned long flags; 5651 unsigned long flags;
5650 int sync = 1; 5652 int wake_flags = WF_SYNC;
5651 5653
5652 if (unlikely(!q)) 5654 if (unlikely(!q))
5653 return; 5655 return;
5654 5656
5655 if (unlikely(!nr_exclusive)) 5657 if (unlikely(!nr_exclusive))
5656 sync = 0; 5658 wake_flags = 0;
5657 5659
5658 spin_lock_irqsave(&q->lock, flags); 5660 spin_lock_irqsave(&q->lock, flags);
5659 __wake_up_common(q, mode, nr_exclusive, sync, key); 5661 __wake_up_common(q, mode, nr_exclusive, wake_flags, key);
5660 spin_unlock_irqrestore(&q->lock, flags); 5662 spin_unlock_irqrestore(&q->lock, flags);
5661} 5663}
5662EXPORT_SYMBOL_GPL(__wake_up_sync_key); 5664EXPORT_SYMBOL_GPL(__wake_up_sync_key);