From: tip-bot for Mike Galbraith <mgalbraith@suse.de>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, mgalbraith@suse.de, hpa@zytor.com,
mingo@redhat.com, a.p.zijlstra@chello.nl, efault@gmx.de,
tglx@linutronix.de, mingo@elte.hu
Subject: [tip:sched/core] sched: Use rt.nr_cpus_allowed to recover select_task_rq() cycles
Date: Tue, 6 Dec 2011 01:50:24 -0800 [thread overview]
Message-ID: <tip-76854c7e8f3f4172fef091e78d88b3b751463ac6@git.kernel.org> (raw)
In-Reply-To: <1321971504.6855.15.camel@marge.simson.net>
Commit-ID: 76854c7e8f3f4172fef091e78d88b3b751463ac6
Gitweb: http://git.kernel.org/tip/76854c7e8f3f4172fef091e78d88b3b751463ac6
Author: Mike Galbraith <mgalbraith@suse.de>
AuthorDate: Tue, 22 Nov 2011 15:18:24 +0100
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 6 Dec 2011 08:51:26 +0100
sched: Use rt.nr_cpus_allowed to recover select_task_rq() cycles
rt.nr_cpus_allowed is always available, use it to bail from select_task_rq()
when only one cpu can be used, and saves some cycles for pinned tasks.
See the line marked with '*' below:
# taskset -c 3 pipe-test
PerfTop: 997 irqs/sec kernel:89.5% exact: 0.0% [1000Hz cycles], (all, CPU: 3)
------------------------------------------------------------------------------------------------
Virgin Patched
samples pcnt function samples pcnt function
_______ _____ ___________________________ _______ _____ ___________________________
2880.00 10.2% __schedule 3136.00 11.3% __schedule
1634.00 5.8% pipe_read 1615.00 5.8% pipe_read
1458.00 5.2% system_call 1534.00 5.5% system_call
1382.00 4.9% _raw_spin_lock_irqsave 1412.00 5.1% _raw_spin_lock_irqsave
1202.00 4.3% pipe_write 1255.00 4.5% copy_user_generic_string
1164.00 4.1% copy_user_generic_string 1241.00 4.5% __switch_to
1097.00 3.9% __switch_to 929.00 3.3% mutex_lock
872.00 3.1% mutex_lock 846.00 3.0% mutex_unlock
687.00 2.4% mutex_unlock 804.00 2.9% pipe_write
682.00 2.4% native_sched_clock 713.00 2.6% native_sched_clock
643.00 2.3% system_call_after_swapgs 653.00 2.3% _raw_spin_unlock_irqrestore
617.00 2.2% sched_clock_local 633.00 2.3% fsnotify
612.00 2.2% fsnotify 605.00 2.2% sched_clock_local
596.00 2.1% _raw_spin_unlock_irqrestore 593.00 2.1% system_call_after_swapgs
542.00 1.9% sysret_check 559.00 2.0% sysret_check
467.00 1.7% fget_light 472.00 1.7% fget_light
462.00 1.6% finish_task_switch 461.00 1.7% finish_task_switch
437.00 1.5% vfs_write 442.00 1.6% vfs_write
431.00 1.5% do_sync_write 428.00 1.5% do_sync_write
* 413.00 1.5% select_task_rq_fair 404.00 1.5% _raw_spin_lock_irq
386.00 1.4% update_curr 402.00 1.4% update_curr
385.00 1.4% rw_verify_area 389.00 1.4% do_sync_read
377.00 1.3% _raw_spin_lock_irq 378.00 1.4% vfs_read
369.00 1.3% do_sync_read 340.00 1.2% pipe_iov_copy_from_user
360.00 1.3% vfs_read 316.00 1.1% __wake_up_sync_key
342.00 1.2% hrtick_start_fair 313.00 1.1% __wake_up_common
Signed-off-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1321971504.6855.15.camel@marge.simson.net
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/sched/fair.c | 3 +++
kernel/sched/rt.c | 3 +++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 96a9ece..8e534a0 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2744,6 +2744,9 @@ select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flags)
int want_sd = 1;
int sync = wake_flags & WF_SYNC;
+ if (p->rt.nr_cpus_allowed == 1)
+ return prev_cpu;
+
if (sd_flag & SD_BALANCE_WAKE) {
if (cpumask_test_cpu(cpu, tsk_cpus_allowed(p)))
want_affine = 1;
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 023b355..58a4844 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1200,6 +1200,9 @@ select_task_rq_rt(struct task_struct *p, int sd_flag, int flags)
cpu = task_cpu(p);
+ if (p->rt.nr_cpus_allowed == 1)
+ goto out;
+
/* For anything but wake ups, just return the task_cpu */
if (sd_flag != SD_BALANCE_WAKE && sd_flag != SD_BALANCE_FORK)
goto out;
next prev parent reply other threads:[~2011-12-06 9:50 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-15 9:46 sched: Avoid SMT siblings in select_idle_sibling() if possible Peter Zijlstra
2011-11-16 1:14 ` Suresh Siddha
2011-11-16 9:24 ` Mike Galbraith
2011-11-16 18:37 ` Suresh Siddha
2011-11-17 1:59 ` Mike Galbraith
2011-11-17 15:38 ` Mike Galbraith
2011-11-17 15:56 ` Peter Zijlstra
2011-11-17 16:38 ` Mike Galbraith
2011-11-17 17:36 ` Suresh Siddha
2011-11-18 15:14 ` Mike Galbraith
2011-11-18 15:17 ` [patch 1/6] sched: use rt.nr_cpus_allowed to recover select_task_rq() cycles Mike Galbraith
2011-11-18 15:35 ` Peter Zijlstra
2011-11-18 17:34 ` Mike Galbraith
2011-11-22 14:17 ` Mike Galbraith
2011-11-22 14:18 ` [patch 1/7] " Mike Galbraith
2011-12-06 9:50 ` tip-bot for Mike Galbraith [this message]
2011-11-22 14:20 ` [patch 2/7] sched: save some hrtick_start_fair cycles Mike Galbraith
2011-12-06 20:20 ` [tip:sched/core] sched: Save " tip-bot for Mike Galbraith
2011-11-22 14:21 ` [patch 3/7] sched: set skip_clock_update in yield_task_fair() Mike Galbraith
2011-11-23 11:53 ` Peter Zijlstra
2011-11-23 12:06 ` Mike Galbraith
2011-11-23 14:48 ` Peter Zijlstra
2011-11-24 3:50 ` Mike Galbraith
2011-11-24 10:12 ` Peter Zijlstra
2011-11-25 6:39 ` Mike Galbraith
2011-12-06 9:51 ` [tip:sched/core] sched: Set " tip-bot for Mike Galbraith
2011-11-22 14:22 ` [patch 4/7] sched: convert rq->avg_idle to rq->avg_event Mike Galbraith
2011-11-23 11:55 ` Peter Zijlstra
2011-11-23 12:09 ` Mike Galbraith
2011-11-23 12:27 ` Peter Zijlstra
2011-11-23 12:57 ` Mike Galbraith
2011-11-23 14:21 ` Mike Galbraith
2011-11-22 14:23 ` [patch 5/7] sched: ratelimit select_idle_sibling()for sync wakeups Mike Galbraith
2011-11-22 14:24 ` [patch 6/7] sched: use rq->avg_event to resurrect nohz ratelimiting Mike Galbraith
2011-11-23 11:57 ` Peter Zijlstra
2011-11-23 12:35 ` Mike Galbraith
2011-11-22 14:26 ` [patch 7/7] sched: only use TTWU_QUEUE when waker/wakee CPUs do not share top level cache Mike Galbraith
2011-11-23 12:08 ` Peter Zijlstra
2011-11-18 15:39 ` [patch 1/6] sched: use rt.nr_cpus_allowed to recover select_task_rq() cycles Hillf Danton
2011-11-18 15:18 ` [patch 2/6] sched: convert rq->avg_idle to rq->avg_event Mike Galbraith
2011-11-18 15:19 ` [patch 3/6] sched: use rq->avg_event to resurrect nohz ratelimiting Mike Galbraith
2011-11-18 15:36 ` Peter Zijlstra
2011-11-18 17:42 ` Mike Galbraith
2011-11-19 0:51 ` Van De Ven, Arjan
2011-11-19 4:15 ` Mike Galbraith
2011-11-18 15:20 ` [patch 4/6] sched: ratelimit select_idle_sibling()for sync wakeups Mike Galbraith
2011-11-18 15:22 ` [patch 5/6] sched: save some hrtick_start_fair cycles Mike Galbraith
2011-11-18 15:23 ` [patch 6/6] sched: set skip_clock_update in yield_task_fair() Mike Galbraith
2012-02-20 14:41 ` sched: Avoid SMT siblings in select_idle_sibling() if possible Peter Zijlstra
2012-02-20 15:03 ` Srivatsa Vaddagiri
2012-02-20 18:25 ` Mike Galbraith
2012-02-21 0:06 ` Srivatsa Vaddagiri
2012-02-21 6:37 ` Mike Galbraith
2012-02-21 8:09 ` Srivatsa Vaddagiri
2012-02-20 18:14 ` Mike Galbraith
2012-02-20 18:15 ` Peter Zijlstra
2012-02-20 19:07 ` Peter Zijlstra
2012-02-21 5:43 ` Mike Galbraith
2012-02-21 8:32 ` Srivatsa Vaddagiri
2012-02-21 9:21 ` Mike Galbraith
2012-02-21 10:37 ` Peter Zijlstra
2012-02-21 14:58 ` Srivatsa Vaddagiri
2012-02-23 10:49 ` Srivatsa Vaddagiri
2012-02-23 11:19 ` Ingo Molnar
2012-02-23 12:18 ` Srivatsa Vaddagiri
2012-02-23 11:20 ` Srivatsa Vaddagiri
2012-02-23 11:26 ` Ingo Molnar
2012-02-23 11:32 ` Srivatsa Vaddagiri
2012-02-23 16:17 ` Ingo Molnar
2012-02-23 11:21 ` Mike Galbraith
2012-02-25 6:54 ` Srivatsa Vaddagiri
2012-02-25 8:30 ` Mike Galbraith
2012-02-27 22:11 ` Suresh Siddha
2012-02-28 5:05 ` Mike Galbraith
2011-11-17 19:08 ` Suresh Siddha
2011-11-18 15:12 ` Peter Zijlstra
2011-11-18 15:26 ` Mike Galbraith
2011-12-06 9:49 ` [tip:sched/core] sched: Clean up domain traversal in select_idle_sibling() tip-bot for Suresh Siddha
2011-11-18 23:40 ` [tip:sched/core] sched: Avoid SMT siblings in select_idle_sibling() if possible tip-bot for Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-76854c7e8f3f4172fef091e78d88b3b751463ac6@git.kernel.org \
--to=mgalbraith@suse.de \
--cc=a.p.zijlstra@chello.nl \
--cc=efault@gmx.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).