diff options
author | Nicholas Mc Guire <der.herr@hofr.at> | 2014-03-24 12:18:48 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-05-14 18:38:19 (GMT) |
commit | 67c9ab800f28628d0cdd99a90eca2924dd571944 (patch) | |
tree | c70df790f322bda134665813688c7482ee9cfe7e /kernel/rcutree.h | |
parent | bc42c0d3f0a8d889c96ee396d37aa00ff634c3f2 (diff) | |
download | linux-fsl-qoriq-67c9ab800f28628d0cdd99a90eca2924dd571944.tar.xz |
sched: dont calculate hweight in update_migrate_disable()
Proposal for a minor optimization in update_migrate_disable - its only a few
instructions saved but those are in the hot path of locks so it might be worth
it
When being scheduled out while migrate_disable > 0 and migrate_disabled_updated
is not yet set we end up here (kernel/sched/core.c):
static inline void update_migrate_disable(struct task_struct *p)
{
...
mask = tsk_cpus_allowed(p);
if (p->sched_class->set_cpus_allowed)
p->sched_class->set_cpus_allowed(p, mask);
p->nr_cpus_allowed = cpumask_weight(mask);
as we only can get here if migrate_disable > 0 there is no need to calculate
the cpumask_weight(mask) as tsk_cpus_allowed in that case will return
cpumask_of(task_cpu(p)) which only can have a hamming weight of 1 anyway.
So we can simply do:
p->nr_cpus_allowed = 1;
without changing the behavior.
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Diffstat (limited to 'kernel/rcutree.h')
0 files changed, 0 insertions, 0 deletions