Re: [PATCH] How to write a portable "run_on" program?

Linus Torvalds (torvalds@transmeta.com)
Wed, 7 May 2003 22:31:43 -0700 (PDT)


On Thu, 8 May 2003, Rusty Russell wrote:
> Currently you need to do the following in userspace to set your
> affinity portably:

This is not true, and as long as you continue to claim this, nobody sane
can take you seriously.

I have several times told you that the proper way to do it is the same as
for fd_set, and in fact you can use "fdset" as the CPU set _today_, even
if it looks a bit strange.

In other words, the proper way to do set_cpu() is

int set_cpu(int cpu)
{
fd_set cpuset;

FD_ZERO(&cpuset);
FD_SET(cpu, cpuset);
return sched_setaffinity(getpid(), sizeof(cpuset), &cpuset);
}

which is a HELL OF A LOT more readable than the crap you're spouting
(either your "before" _or_ your "after" crap).

And if you want to make it more readable still, you make a "cpuset.h"
header file that creates a "cpu_set" type instead of "fd_set". You can
do it by search-and-replace of the fd_set stuff if you want to.

But yeah, if you by "portable" mean that it won't handle more than 1024
CPUs, then I guess it isn't portable. But guess what? I don't care. If you
seriously expect to have more than 1024 CPUs in the near future, make the
cpu_set be bigger.

But I expect you to ignore this email too, the way you ignored my previous
ones. The same way I'll continue to ignore your idiotic patches.

Linus

-
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/