Don't set affinity if didn't specify -ss#49
Don't set affinity if didn't specify -ss#49lijing0010 wants to merge 1 commit intoOpenVisualCloud:masterfrom
Conversation
User can still use taskset to specify the cores, this works for non-numa CPU cases Signed-off-by: Jing Li <jing.b.li@intel.com>
| config_ptr->logical_processors < num_logical_processors ? config_ptr->logical_processors : num_logical_processors; | ||
| for (uint32_t i = 0; i < lps; i++) | ||
| CPU_SET(lp_group[0].group[i], &group_affinity); | ||
| if (config_ptr->target_socket != -1) { |
There was a problem hiding this comment.
Same comment as for HEVC. The change is not needed.
|
Hi @lijing0010 & @tianjunwork , Let's talk about the topic with SVT-HEVC PR #353 together, although the latter one has been merged. At first, in my opinion, the CPU affinity setting isn't related to the CPU socket or the number of CPU (logic) cores of an SMP system. The "-ss" and "-lp" options wouldn't impact the affinity function (except that some processor bit masks for the "-c" option of taskset will be ommitted, with some "-ss" and "-lp" combination). As for @lijing0010 's request to use taskset to set affinity for single socket CPU, we can use taskset before launching the encoding process or after encoding is launched. But we should notice that taskset itself calls sched_setaffinity() and then execve to run the specified process, which may also invoke pthread_setaffinity_np() (implemented on top of sched_setaffinity()). In the 2 cases either taskset is before or after encoding process launched, the second call of sched_setaffinity() overrides the first one. But each encoding kernel thread will be bound to unforseen active logic cores via pthread_setaffinity_np() scheduled by Linux kernel scheduler, taskset couldn't have the affinity result which the user targets for, like what @lijing0010 concerned. So the only way is to launch the encoding process at first, get its PID and then run taskset with "-p" option to override previous affinity setting. I think both of the 2 PRs should be reverted, otherwise we couldn't get benefit from CPU affinity in case that the user doesn't add the "-ss" option (for single socket CPU). Or both of them should be reworked, by setting CPU affinitiy for all logic cores, only if the returned CPU affinity mask of pthread_getaffinity_np() is all 0 with one bit position excluded. Thanks! |
User can still use taskset to specify the cores, this works for non-numa
CPU cases
Signed-off-by: Jing Li jing.b.li@intel.com