Re: [PATCH] mask ADT: replace cpumask_t implementation [3/22]
From: Matthew Dobson
Date: Thu Apr 01 2004 - 15:43:47 EST
On Thu, 2004-04-01 at 07:22, Paul Jackson wrote:
> > > #define cpu_online_map cpumask_of_cpu(0)
> > > #define cpu_possible_map cpumask_of_cpu(0)
> > > ...
> > Might it make more sense to actually define a cpu_online_map &
> > cpu_possible_map for UP, rather than generating this code:
> >
> > #define mask_of_bit(bit, T) \
> > ({ \
> > typeof(T) m; \
> > mask_clearall(m); \
> > mask_setbit((bit), m); \
> > m; \
> > })
> >
> > every time some code references cpu_online_map? It'll only cost us 2
> > unsigned longs on 32-bit == 8 bytes...
>
> Perhaps.
>
> When I looked at the code just now, this only seemed to take a
> couple of instructions. Do you think that there is much to gain?
> Better a couple of inline instructions than a possible uncached
> memory reference, I suspect.
Yeah, you may be right about that.
On UP it should compile as such:
cpu_online_map => cpumask_of_cpu(0) =>
mask_of_bit(0, _unused_cpumask_arg_) =>
({ typeof(_unused_cpumask_arg_) m; mask_clearall(m); mask_setbit(0, m);
m; }) =>
({ cpumask_t m; m._m[0] = 0UL; set_bit(0, m._m); m; })
Maybe we could #define it better on UP. Something along the lines of:
#define cpu_online_map ({ cpumask_t up_cpu_map = { 1UL }; })
That way we'll get this inlined, plus very little code to execute?
Cheers!
-Matt
-
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/