[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140324101800.3f978842@gandalf.local.home>
Date: Mon, 24 Mar 2014 10:18:00 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Nicholas Mc Guire <der.herr@...r.at>
Cc: linux-rt-users@...r.kernel.org, linux-kernel@...r.kernel.org,
tglx@...utronix.de,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH RT] dont calculate hweight in update_migrate_disable
On Mon, 24 Mar 2014 13:18:48 +0100
Nicholas Mc Guire <der.herr@...r.at> wrote:
> Hi !
>
> 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.
>
> Patch is on top of 3.12.13-rt21
>
Reviewed-by: Steven Rostedt <rostedt@...dmis.org>
-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists