On 18/01/17 00:30, Dario Faggioli wrote:
> Since we are doing cpumask manipulation already, clear a bit
> in the mask at once. Doing that will save us an if, later in
> the code.
> 
> No functional change intended.
> 
> Signed-off-by: Dario Faggioli <dario.faggi...@citrix.com>
> ---
> Cc: George Dunlap <george.dun...@eu.citrix.com>
> ---
>  xen/common/sched_credit2.c |    5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c
> index ef8e0d8..d086264 100644
> --- a/xen/common/sched_credit2.c
> +++ b/xen/common/sched_credit2.c
> @@ -985,7 +985,7 @@ runq_tickle(const struct scheduler *ops, struct 
> csched2_vcpu *new, s_time_t now)
>      cpumask_andnot(&mask, &rqd->active, &rqd->idle);
>      cpumask_andnot(&mask, &mask, &rqd->tickled);
>      cpumask_and(&mask, &mask, new->vcpu->cpu_hard_affinity);
> -    if ( cpumask_test_cpu(cpu, &mask) )
> +    if ( __cpumask_test_and_clear_cpu(cpu, &mask) )

Since we're micro-optimizing -- isn't test-and-clear a locked operation?
 Would that be more expensive than the if() statement below?

 -George


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to