Re: [PATCH] cpumask 5/10 rewrite cpumask.h - single bitmap based implementation

Paul Jackson
2004-06-04T06:42:30Z

> Where do we stand wrt pass-by-reference?

I haven't found any place yet that I noticed this to be a problem.

Of course it's not a problem in the internals of the cpumask
implementation, because the very first layer of implementation, the
#define's, converts pass by value to pass by reference (and adds the
NR_CPUS where that helps). Then the bitmap ops in the next layer down
convert right back to single word operations by value, in the usual
NR_CPUS <= BITS_PER_LONG case, all within the scope of the compiler
code-generator.

If there was a place where it was important to pass a cpumask argument
by reference for efficiency, then I would claim that this should be done
by explicitly making the argument in question a (cpumask_t *) pointer,
instead of a cpumask_t value. This is the usual technique when passing
potentially large structures, when a local private copy is not needed.

If further such a place was in generic kernel code, where the vast
majority running on more reasonably sized hardware would object to
such, either because of esthetics, or efficiency (wasting a pointer
dereference) then ... cross that bridge when the water rises.

Hopefully, localized solutions could be developed for such needs,
without dragging back in all the complexity of the generalized
variability we had before.

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.650.933.1373