eal: restrict cores auto detection
authorJianfeng Tan <jianfeng.tan@intel.com>
Fri, 2 Dec 2016 17:48:56 +0000 (17:48 +0000)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 21 Dec 2016 14:31:16 +0000 (15:31 +0100)
commit2eba8d21f3c9ea39b64ac12c0ac3288a7dc57b63
tree514db141a1d56927a9694edd11364420d8c4749a
parent12b9b2ee7058cb39069b80052f958f396ddaa891
eal: restrict cores auto detection

This patch uses pthread_getaffinity_np() to narrow down used
cores when none of below options is specified:
  * coremask (-c)
  * corelist (-l)
  * and coremap (--lcores)

The purpose of this patch is to leave out these core related options
when DPDK applications are deployed under container env, so that
users do not need decide the core related parameters when developing
applications. Instead, when applications are deployed in containers,
use cpu-set to constrain which cores can be used inside this container
instance. And DPDK application inside containers just rely on this
auto detect mechanism to start polling threads.

Note: previously, some users are using isolated CPUs, which could
be excluded by default. Please add commands like taskset to use
those cores.

Test example:
$ taskset 0xc0000 ./examples/helloworld/build/helloworld -m 1024

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
lib/librte_eal/common/eal_common_options.c