6

I am trying to use taskset to assign some processes to specific CPU's. When I run taskset, it appears that the command has worked as I get a reply stating what the new affinity of the process is set.

However when i monitor the top output (the process that i am trying to assign a cpu to is running at a high cpu percentage), I can see that the process is still switching between cpus so it looks like the taskset is not working.

When searching the web for similar issues, I see a posting on the Red Hat site https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_MRG/1.1/html/Realtime_Tuning_Guide/sect-Realtime_Tuning_Guide-Realtime_Specific_Tuning-Non_Uniform_Memory_Access.html

This states that taskset will not work on numa enabled systems. Is this the case? I have not been able to find this out from anywhere else.

The taskset command that I am using is

taskset -pc 1-2 16723 pid 16723's current affinity list: 0-7 pid 16723's new affinity list: 1,2

I also tried:

taskset -p 0x00000001 16723

The version of OS is:

Description: Ubuntu 12.04.1 LTS Release: 12.04

Kernel Version: Linux hadoop 3.2.0-29-generic #46-Ubuntu SMP Fri Jul 27 17:03:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

Before I look at using cgroups, I would have thought that taskset would work to at least assign cpu affinity for a process?

Thanks,

Also to confirm that numa is not disabled on my host From http://martincarstenbach.wordpress.com/2012/04/27/little-things-i-didnt-know-difference-between-_enable_numa_support-and-numactl/

more /proc/cmdline

BOOT_IMAGE=/boot/vmlinuz-3.2.0-29-generic root=UUID=3221e122-b2fb-48b7-b761-16c57ef51f9a ro quiet splash vt.handoff=7

Confirming that this is on a physical host.

2
  • 1
    Please show your taskset command line and specify with OS/distribution and kernel version you're using. (you should also be using cgroups, instead)
    – ewwhite
    Nov 8, 2012 at 13:54
  • taskset -pc 1-2 constricts cpus 1 and 2, while taskset -p 0x00000001 restricts to cpu0. Leaving that aside, I would expect this to work. Do you really have a NUMA AMD system? Using taskset is not always the right way to solve a problem - upping the sched_migration_cost might be a better solution
    – symcbean
    Nov 8, 2012 at 15:08

1 Answer 1

2

run the command "numastat" - if your system is numa, you should see it in the results. Like you suspect - if your system is numa use numactl to set up your process to run on a range of cpus.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .