Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ht_affinity.c: fix ht_affinity test failure
Running ht_affinity test fails: smt_smp_affinity 0 TINFO : Set affinity through system call smt_smp_affinity 0 TINFO : Set test process affinity. mask: 1 smt_smp_affinity 0 TINFO : ...Error ... smt_smp_affinity 0 TINFO : Set test process affinity. mask: c0000000 smt_smp_affinity 0 TINFO : ...Error smt_smp_affinity 3 TFAIL : ht_affinity.c:240: System call setaffinity() is error. The type of cpumask pointer used in set_affinity() is unsigned long, but ht_affinity used a unsigned int pointer. When kernel copy cpumask from user-space pointer, the high 32bit of cpumask is a random value. So the process can't be bind to the cpu specified by users. After using sizeof on the mask instead of sizeof(unsigned long), ht_affinity test succeeds: smt_smp_affinity 0 TINFO : Set affinity through system call smt_smp_affinity 0 TINFO : Set test process affinity. mask: 1 smt_smp_affinity 0 TINFO : ...OK ... smt_smp_affinity 0 TINFO : Set test process affinity. mask: c0000000 smt_smp_affinity 0 TINFO : ...OK smt_smp_affinity 3 TPASS : System call setaffinity() is OK. Signed-off-by: Haifeng Xu <[email protected]> Suggested-by: Cyril Hrubis <[email protected]> Reviewed-by: Cyril Hrubis <[email protected]>
- Loading branch information