[Devel] [PATCH hci-8.1 v3 1/2] sched: Fix sched_getaffinity syscall

Vladimir Riabchun vladimir.riabchun at virtuozzo.com
Wed Nov 18 22:41:48 MSK 2026



On 11/12/26 19:37, Konstantin Khorenko wrote:
> I won't apply this version, please send v4 with the changes below.
> 
> On Thu, 29 Oct 2026 11:16:06 +0100, Vladimir Riabchun <vladimir.riabchun at virtuozzo.com> wrote:
>> The root cause is incorrect bitmap_fill usage - it sets whole
>> integers only, without handling bit tails, so the actual number of
>> set bits is 64 = bits in ULONG.
> 
> Items 1 and 2 of the cover letter reply: add the Fixes: and Feature:
> trailers, write "whole unsigned longs", and say what a CT sees now.
> 
> Why: 87211cbff4b4 added the CT branch with bitmap_fill(). Since v3
> the vCPU limit comes from the target task and the count follows the
> cpuset, so nproc may differ from /proc/cpuinfo. A reader of the
> message should not have to find that in the cover changelog.

Will fix in v4.

> 
>> +		/*
>> +		 * setaffinity is not available inside CT, so these bits
>> +		 * can only be used for counting.
> 
> Item 3: sched_setaffinity() returns 0 in a CT and does nothing, it is
> not "not available".

This is actually very misleading. Maybe we want to explicitly return
-EPERM from sched_setaffinity in !ve_is_super(get_exec_env()) case?
Or the userspace will break? I tried with -EPERM and CTs start
just fine.

> 

-- 
Best regards, Riabchun Vladimir
Linux Kernel Developer, Virtuozzo



More information about the Devel mailing list