Commit 71e20f1873d46e138c26ce83f8fe54b7221f572f

Authored by Ingo Molnar
1 parent d172fcd3ae

sched: affine sync wakeups

make sync wakeups affine for cache-cold tasks: if a cache-cold task
is woken up by a sync wakeup then use the opportunity to migrate it
straight away. (the two tasks are 'related' because they communicate)

Signed-off-by: Ingo Molnar <mingo@elte.hu>

Showing 3 changed files with 12 additions and 6 deletions Side-by-side Diff

... ... @@ -382,7 +382,7 @@
382 382  
383 383 /* Signal writers asynchronously that there is more room. */
384 384 if (do_wakeup) {
385   - wake_up_interruptible(&pipe->wait);
  385 + wake_up_interruptible_sync(&pipe->wait);
386 386 kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
387 387 }
388 388 if (ret > 0)
... ... @@ -555,7 +555,7 @@
555 555 out:
556 556 mutex_unlock(&inode->i_mutex);
557 557 if (do_wakeup) {
558   - wake_up_interruptible(&pipe->wait);
  558 + wake_up_interruptible_sync(&pipe->wait);
559 559 kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
560 560 }
561 561 if (ret > 0)
... ... @@ -649,7 +649,7 @@
649 649 if (!pipe->readers && !pipe->writers) {
650 650 free_pipe_info(inode);
651 651 } else {
652   - wake_up_interruptible(&pipe->wait);
  652 + wake_up_interruptible_sync(&pipe->wait);
653 653 kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
654 654 kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
655 655 }
... ... @@ -1521,6 +1521,12 @@
1521 1521 unsigned long tl = this_load;
1522 1522 unsigned long tl_per_task;
1523 1523  
  1524 + /*
  1525 + * Attract cache-cold tasks on sync wakeups:
  1526 + */
  1527 + if (sync && !task_hot(p, rq->clock, this_sd))
  1528 + goto out_set_cpu;
  1529 +
1524 1530 schedstat_inc(p, se.nr_wakeups_affine_attempts);
1525 1531 tl_per_task = cpu_avg_load_per_task(this_cpu);
1526 1532  
... ... @@ -1598,7 +1604,7 @@
1598 1604 * the waker guarantees that the freshly woken up task is going
1599 1605 * to be considered on this CPU.)
1600 1606 */
1601   - if (!sync || cpu != this_cpu)
  1607 + if (!sync || rq->curr == rq->idle)
1602 1608 check_preempt_curr(rq, p);
1603 1609 success = 1;
1604 1610  
... ... @@ -334,7 +334,7 @@
334 334 read_lock(&sk->sk_callback_lock);
335 335 if (unix_writable(sk)) {
336 336 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
337   - wake_up_interruptible(sk->sk_sleep);
  337 + wake_up_interruptible_sync(sk->sk_sleep);
338 338 sk_wake_async(sk, 2, POLL_OUT);
339 339 }
340 340 read_unlock(&sk->sk_callback_lock);
... ... @@ -1639,7 +1639,7 @@
1639 1639 if (!skb)
1640 1640 goto out_unlock;
1641 1641  
1642   - wake_up_interruptible(&u->peer_wait);
  1642 + wake_up_interruptible_sync(&u->peer_wait);
1643 1643  
1644 1644 if (msg->msg_name)
1645 1645 unix_copy_addr(msg, skb->sk);