In message <Pine.LNX.4.44.0206181302300.872-100000@home.transmeta.com> you writ
e:
> On Wed, 19 Jun 2002, Rusty Russell wrote:
> >
> > NO. They want to be node-affine. They don't want to specify what
> > CPUs they attach to.
>
> So you're going to have separate interfaces for that? Gag me with a volvo,
> but that's idiotic.
No, you have accepted a non-portable userspace interface and put it in
generic code. THAT is idiotic.
So any program that doesn't use the following is broken:
#include <limits.h>
#define BITS_PER_LONG (sizeof(long)*CHAR_BIT)
int set_cpu(int cpu)
{
size_t size = sizeof(unsigned long);
unsigned long *bitmask = NULL;
int ret;
do {
size *= 2;
bitmask = realloc(bitmask, size);
memset(bitmask, 0, size);
bitmask[cpu / BITS_PER_LONG] = (1 << (cpu % BITS_PER_LONG);
ret = sched_setaffinity(getpid(), size, bitmask);
} while (ret < 0 && errno = -EINVAL);
return ret;
}
> Besides, even that would be broken. You want bitmaps, because bitmaps is
> really what it is all about. It's NOT about "I must run on this CPU", it
> can equally well be "I mustn't run on those two CPU's that are hosting the
> RT part of this thing" or something like that.
Just bind to a cpu != those two CPUs. I could come up with contrived
examples too, but I'm trying to save userspace programmers and those
who have to port to new architectures.
If you don't know how to do it well, do it simply.
Rusty.
-- Anyone who quotes me in their sig is an idiot. -- Rusty Russell. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sun Jun 23 2002 - 22:00:17 EST