kohler / click

The Click modular router: fast modular packet processing and analysis
Other
748 stars 321 forks source link

Add --cpu=N option to click userlevel #319

Closed tbarbette closed 7 years ago

tbarbette commented 7 years ago

Like linuxmodule cpu parameter, it allows to set up an offset N for thread affinity. Click's thread I will be pinned to core I+N. If N is not given (just passing --cpu or -a), the offset will be 0, which is the old behaviour considering "-a". If the parameter is not given or N is negative, the thread will have no affinity.

FWY, this is ignored by DPDK as DPDK uses its own mask in EAL arguments.

ahenning commented 7 years ago

Hi @tbarbette

It is not completely clear:

If N is not given (just passing --cpu or -a), the offset will be 0, which is the old behaviour considering "-a". If the parameter is not given or N is negative, the thread will have no affinity.

Isn't the old behavior that thread 0 affinity is core 0 ? So after this change to get the equivalent of the previous default behavior is to run "-a 0" ?

Edit: NM, read "if the parameter is not given" as "if the N parameter is not given", which should probably be read as "if the -a parameter is not given"

tbarbette commented 7 years ago

The previous behaviour of -a is the equivalent of "-a=0" "--cpu=0" or "-a" or "--cpu" as the default if no "=N" is to assume 0.

The previous behaviour of giving nothing (well, after the discussed bugfix already pushed to master) is to give nothing or "-a=-1" "--cpu=-1"

tbarbette commented 7 years ago

Done. I also added a testie.

kohler commented 7 years ago

Great, thanks Tom!!