Re: Question about setting affinity in 2.4

From: Arjan van de Ven
Date: Mon Feb 19 2007 - 08:33:26 EST

On Sun, 2007-02-18 at 18:02 -0800, Phy Prabab wrote:
> Hello everyone,
> I am trying to set affinity on a program to make sure I can get the
> best use of the cache as possible and to eliminate as much noise as
> possible with running my program. I have tried unsuccessfully to set
> affinity using sched_set/getaffinity and the CPU_SET macros. In
> particular, I can not seem to get the process to use affinity I
> specify as in:
> int main () {
> cpu_set_t mask;
> cpu_set_t setmask;
> long long x;
> double foo;
> printf("Mask set to %08lx\n", sched_getaffinity(0, &mask));

int sched_setaffinity(pid_t pid, unsigned int cpusetsize,
cpu_set_t *mask);

sched_setaffinity takes 3 not 2 parameters.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at