From 936f9d45baf474358346666ed9ad7f56960bb455 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 6 Sep 2013 16:36:56 +0200 Subject: Don't apply the CPU affinity hack to nix-shell (and other Perl programs) As discovered by Todd Veldhuizen, the shell started by nix-shell has its affinity set to a single CPU. This is because nix-shell connects to the Nix daemon, which causes the affinity hack to be applied. So we turn this off for Perl programs. --- src/libutil/affinity.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/libutil/affinity.cc') diff --git a/src/libutil/affinity.cc b/src/libutil/affinity.cc index 7a6310cadb00..3e21f43a2e9d 100644 --- a/src/libutil/affinity.cc +++ b/src/libutil/affinity.cc @@ -33,13 +33,12 @@ void setAffinityTo(int cpu) int lockToCurrentCPU() { #if HAVE_SCHED_SETAFFINITY - if (getEnv("NIX_AFFINITY_HACK", "1") == "1") { - int cpu = sched_getcpu(); - if (cpu != -1) setAffinityTo(cpu); - return cpu; - } -#endif + int cpu = sched_getcpu(); + if (cpu != -1) setAffinityTo(cpu); + return cpu; +#else return -1; +#endif } -- cgit 1.4.1