From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 8BC64803F6 for ; Thu, 12 Nov 2026 18:39:07 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6ACIbpxJ011536; Thu, 12 Nov 2026 21:37:52 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6ACIbpxJ011536 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="rDXCzPDy" Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6ACIbivg011519 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Thu, 12 Nov 2026 21:37:44 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6ACIbivg011519 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4a359b714f8so416765e9.2 for ; Thu, 12 Nov 2026 10:37:44 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErEXcT8DTAoRfRPobORVDSTlSaVNyaTB50FeY2IxAiAeTIpjJ67zrK07Ux85UwLVqDwywZ/neQ==@openvz.org X-Gm-Message-State: APuU4Z+ouQIEDfPGUK7nHbiYYYz4KIjijhxnE13mQm1TjD949HvsHgzg L99/n5EXDryWXOWMRTlU07uy5RgfywIgTZd4VBVlX0xyRFAiDaWg5QMbCOGVn/9q2D0dPVRGOJS GWfkpLIstFdsww3tzp+Z6fp1ZyqziMjvSvcWAvCcxdb4el33EwtvGZg== X-Gm-Gg: AYBFou2I1YNNXZ9PfPgljHBYQLVgOJghIBKjDYPm/swumWKxQwY2OnlroVmgktNo41f O/aFQjpU5oZSFua9iwnBgbBVI32nwUqJRacpasaDaP26KJk4dQ5Be+0GJmcgeU4hm6Z5R3YhBgj 3r9XGL7pbMi5wZ2DZV6AEricH1ZOXFyH6Dx/myYfml9riz8tpB20TrcstuYEXdiE6Bs1FpKi1Hi kZAy1sLfhgCq/TgtfYAlqLGG2E0Pm8pnn0v/fwQbkdxKQZ4NEcQUZyuacCOpwfPZYSPi7sfLEwc BDZu4YAEPCq57OSzIkTN0EpW0n1xKSLCIHFLQa1dh0FWY8L+ozW4dg5aFiqLJJp/EflcAgNzHgE CmKiylQJwIB/pLfjT X-Received: by 2002:a05:600c:6387:b0:4a2:a8c:22b0 with SMTP id 5b1f17b1804b1-4bb559f3304mr2792435e9.1.1794508664320; Thu, 12 Nov 2026 10:37:44 -0800 (PST) X-Received: by 2002:a05:600c:6387:b0:4a2:a8c:22b0 with SMTP id 5b1f17b1804b1-4bb559f3304mr2792045e9.1.1794508663793; Thu, 12 Nov 2026 10:37:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794508663; cv=none; d=google.com; s=arc-20260327; b=I1AtCultcnYaByVnMtA91xXEz2sGKiqMqhC4OHJ+PqJ10Uw3we7s23bQb2G1B7b0wa HDiRKJ4lWwZ1RtscygMf3LNv7rHY86Rt7LTEH1dGA37wSB8C+lyXKe+0Um9TE2hfqkxz NqytB2YLQ57EZA4+QwvnhOjC8hOu/d6ggVejqI2gfdaBQjE9mvdtMQ3cJ9f1U4YUDyk+ P+oRwBqGHyncQrKIR3PXwYtOPMA/QUGaKxLH9WRUGL1OlFKo0kKVZOTF9uYspwDsoLh7 sB2I+lBiseg20gBw7mWyy3u5nzR0P56DIl9sQZUSXvS+ZGSGmw+j1LUbHXcJ9vNVTbtc JSRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=message-id:date:references:in-reply-to:cc:to:from:subject :content-transfer-encoding:mime-version:dkim-signature; bh=CItEOeqskt3FyuJjS0jGKgotQy4/351WFsTQrHuiI/w=; fh=Hju15nDV3aAEjHk+2wK59p7A+mxbkh9Bi/LdFFgQ5wE=; b=ZVTehdJWJTMOpUKdzjHIdupSyjSKfYGei2TjXMM53TyVAzDSvDPHQ4AzHtQHSMM82w ijPtZLJyCQ33YqL1UZ0T+hzcoqmJrdTnl0/xNjU3FW6o5KLTr3ngwDxfcZ3QZY4VaUHC ynqfZ4eig3KqnRpmpbvQKatYTsTY85gMoGENlsT/U2uw/pV6ivRGzFUMxU01qqy97aSX gMgks+ykaX3DEhoqIbkHKYxTUz7TvapFqbfjsdBDwKGv66haaQavag1EgpHdj4ZNgAX1 XWKaQWmNzxDpYpZF2FIlGY16YyfQJrDF7mhqb0p4T5n4IJpawjSSizeO4vnC481irqsR lZGg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=rDXCzPDy; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id ffacd0b85a97d-49c64fd6f18si622296f8f.471.2026.11.12.10.37.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2026 10:37:43 -0800 (PST) Received-SPF: pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=rDXCzPDy; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Message-Id:Date:From:Subject:Content-Type: MIME-Version; bh=CItEOeqskt3FyuJjS0jGKgotQy4/351WFsTQrHuiI/w=; b=rDXCzPDyBYvn XdElCYzS/2nblKLLNzb8Y2EtnQaY+JHibvFN/dVgPMMpI6j0V1HpzVoFgQKZFLniBs3SY+r7XelfC 6wGsF14JqHENVVS7IFx+YnyBwMW2zRPOlp7IhVbZFSbP/cKHXNbXAfhAYItSugKOIs4hrJzT6yK4K 2Y6LV8G8fA8mviSi42JsUaamVOH4t5gYW7j1AzV7EyLbL5gYt0hm3XvQcguQV9xvD0AS+88i6+VN0 udJoo7lZP2wy5idiUv6Hm53Emv1u1zn3IqP0jLz7Ujw6Qdnt2FExv+3mq3aWZ0c+FICEUGXpLQFeK zBNCiVo3tQCSZn/C/VXFIw==; Received: from ch-demo-asa.virtuozzo.com ([130.117.225.8] helo=f0.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xRZby-005mG4-0B; Thu, 12 Nov 2026 19:37:40 +0100 MIME-Version: 1.0 From: Konstantin Khorenko To: Vladimir Riabchun In-Reply-To: <20261029-ct-invalid-nrpoc-v3-0-89d4b0b7d520@virtuozzo.com> References: <20261029-ct-invalid-nrpoc-v3-0-89d4b0b7d520@virtuozzo.com> Date: Thu, 12 Nov 2026 19:37:40 +0100 Message-Id: <179450866043.4060562.7827272878398907108.b4-review@b4> X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2201; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=ZOO1Ybx3gF+TtJrHTSsycBwI7YrA0bX7zp0iw+FgQDA=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBq9gd2Hgsrh9bdLOT2NLEp75JIooNURTTGvo2ah JIk7RTTM1SJAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCavYHdgAKCRBRlgpH+WFc KnxmEACBpuw9nS9Hb32WmLVmgsv5bTV482lAC0GKYa3FplZYZQEPkqucR8yAJX+gQmFkBOhA5PX v19qzBMLpZAFxb8DXRHyllFqAufY4vcAiljsVyZZ9Z+SQbLND8J879jt7cHmwjtpaXLb+oz4Ymt WK+ERLTUfuxNyW0iKLrkyICPiD+962/eQAaFfRVa6M542NDwxbB6/NsQANX89isHCY9ajPFphJM K6V4RMqyfanXFr0CZTViwn0fk3f3oJo5eOpw00Sx+te6mxkkIUKO8pEJeOiPkosyDSgofNaH7Lj ge+u1daBKwQ/X6dxrT87TVH9ZBMk4adffxw+PmAp/mIUI0tP8zpWMRSmiEgSpNlbdt9byI/i1Nn 9chBH28fldtW6CyRkEN7W2tV+0FmQxe8LS16ZFOlTT6fX9y/1tiuqM51LVwutGcws1+Owam/lVr WxAm1AZTLkfr+Fk/7+Xw5Ntmd7z8esPJcIQBPvSFfgd9x2HVPgsaI4Ms0BsOZKrVC2OQjWy03cP qIuQEfb8yxLLerY5B7s/2v2HUwlZp3MYe+Vr5PtEdfOnU30KB11X4H3CmX/nzwpvcNjFdciUtuq cbtYs1yVYR9QAkrMhUcBz5SwtwOBRnqGeg5bdBKHxRNHR+5iHB6IoBplqUo5rgJ/JvyEy2A42Ov UwuieRjZ+kQNmqg== X-Developer-Key: i=khorenko@virtuozzo.com; a=openpgp; fpr=560F6DC83DC5D3D063BD082C51960A47F9615C2A X-OZ-Fwd: true Cc: devel@openvz.org Subject: Re: [Devel] [PATCH hci-8.1 v3 0/2] sched: Fix incorrect nproc report inside CT X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org I won't apply this version, please send v4 with the changes below. On Thu, 29 Oct 2026 11:16:05 +0100, Vladimir Riabchun wrote: > nproc code uses sched_getaffinity syscall under the hood[1]. > It appears that this syscall returned complete nonsence when > called from VE - we ignored both num_online_vcpus and > cgroup cpuset limitations. The code of patch 1 is right. What to change for v4: 1. Patch 1: add a Fixes tag for 87211cbff4b4 ("sched: Return only virtual cpus in sched_getaffinity()") and the Feature line of that commit, "sched: virtualize CT cpu affinity management". 2. Patch 1: fix the message. bitmap_fill() fills whole unsigned longs, not integers. Say what a CT sees now: the first min(vCPUs, CPUs of its cpuset) bits, with the vCPU limit of the target task. nproc can then be lower than /proc/cpuinfo and /sys/devices/system/cpu/online, say that this is intended. 3. Patch 1: the code comment says setaffinity is "not available" inside a CT. sched_setaffinity() returns 0 there and does nothing, write that. 4. Patch 2: loop to CPU_SETSIZE in get_nth_cpu(). 5. Patch 2: include , as you promised in the v2 reply, and add a Feature: line. 6. Cover letter: - The old code did use num_online_vcpus(), the bug was the rounding. Ignoring the cpuset was the design of 87211cbff4b4. - "64 no matter what" holds up to 64 vCPUs, above that it was 128. - Typos: "nonsence", "insted". - Link [1] points at a line of gnulib master, which will drift. Name the function instead. Separate patches, not needed for this series; I created a task for it: 1. task_nr_cpus() reads nr_cpus of the task's own cpu cgroup, while vzctl --cpus sets it on the CT root cgroup only. In a nested cpu cgroup inside a CT (docker in a CT, a systemd unit with CPUQuota=) nproc, /proc/cpuinfo and the sysfs cpu lists show the host CPU count. tg_nr_cpus() in cpuacct.c already goes through ve_root_tg(), task_nr_cpus() should do the same. https://virtuozzo.atlassian.net/browse/VSTOR-154938 -- Konstantin Khorenko, Virtuozzo Linux Kernel Team _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel