Re: [PATCH][2.6.7-rc3-mm1] perfctr cpumask cleanup

From: Mikael Pettersson
Date: Thu Jun 10 2004 - 04:52:48 EST


Paul Jackson writes:
> > Clean up perfctr/virtual by using the new cpus_andnot() operation
>
> Neat.
>
> Do you still need "tmp" ? Perhaps you could further add the
> following patch (untested, unbuilt, ...).
>
> This saves copies and stack space for one cpumask (that's
> 512 bits on my SN2 systems).
>
> Signed-off-by: Paul Jackson <pj@xxxxxxx>
>
> Index: 2.6.7-rc3-mm1/drivers/perfctr/virtual.c
> ===================================================================
> --- 2.6.7-rc3-mm1.orig/drivers/perfctr/virtual.c 2004-06-09 15:34:34.000000000 -0700
> +++ 2.6.7-rc3-mm1/drivers/perfctr/virtual.c 2004-06-09 15:38:32.000000000 -0700
> @@ -403,11 +403,10 @@
> return -EFAULT;
>
> if (control.cpu_control.nractrs || control.cpu_control.nrictrs) {
> - cpumask_t tmp, old_mask, new_mask;
> + cpumask_t old_mask, new_mask;
>
> - tmp = perfctr_cpus_forbidden_mask;
> old_mask = tsk->cpus_allowed;
> - cpus_andnot(new_mask, old_mask, tmp);
> + cpus_andnot(new_mask, old_mask, perfctr_cpus_forbidden_mask);

Doesn't work because cpus_andnot() requires all three parameters
to be lvalues. In UP and PowerPC builds, perfctr_cpus_forbidden_mask
is #define:d to CPU_MASK_NONE to allow client-side optimisations.

Making it always be a variable will slow down UP and PowerPC with
unoptimisable cpumask tests; alternatively I'll have to wrap my
cpumask uses with optimisation macros and/or #ifdefs.

/Mikael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/