Re: [LTP] [PATCH] ht_affinity.c: fix ht_affinity test failure

Haifeng Xu via ltp
2024-09-21T04:17:38Z

On 2024/9/20 20:22, Cyril Hrubis wrote:
> Hi!
>> From the kernel source code, the user_mask_ptr is unsigned long.
>>
>> SYSCALL_DEFINE3(sched_setaffinity, pid_t, pid, unsigned int, len,
>> unsigned long __user *, user_mask_ptr)
>>
>> so maybe we can keep the type of user_mask_ptr consistent with it.
>
> It's actually accessed as an array. See get_user_cpu_mask() function just
> above this syscall definition and userspace is suppose to pass an array
> big enough for all the flags of CPUs it cares about.
>
> There are also macros in the libc sched.h header that allows you to
> allocate an array big enough for the current machine and manipulate the
> bits, see man CPU_ALLOC.
>
OK. I'll post next version with your suggestions.
Thanks!