mtcp_core_affinitize − bind a calling thread to a specific CPU core
int mtcp_core_affinitize(int cpu);
mtcp_core_affinitize() binds a calling thread to a specifc CPU core. This function is a utility function which internally performs sched_setaffinity() for dedicating one CPU to a particular thread, and numa_set_membind() for restricting any future memory allocation to happen within the NUMA node.
This function is used by end TCP applications to pin their application threads to a specific core in order to gain performance benefits. For example, restricting an application thread to run on a single CPU core avoids any cache invalidation that can be caused when the thread is moved from one CPU core to another CPU core.
The function requires a sole cpu integer argument that passes the CPU core-id of the system on which the stack is instantiated.
Returns 0 on success; -1 on failure.
Passing an invalid CPU core-id (value < 0 or value > max_cpus) will prevent the creation of the mTCP stack.
mOS development team <firstname.lastname@example.org>
This page is part of mOS release 0.3 docs section. A description of the project, and information about reporting bugs, can be found at http://mos.kaist.edu/.