From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (unknown [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id C1F6A8017D for ; Thu, 24 Sep 2026 12:12:27 +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 68OCB8DI015050; Thu, 24 Sep 2026 15:11:09 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 68OCB8DI015050 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="LTdpUQhQ" Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 68OCB7ki015046 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Thu, 24 Sep 2026 15:11:07 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 68OCB7ki015046 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-47d81cf0c4cso1405913f8f.2 for ; Thu, 24 Sep 2026 05:11:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBz5UzT0TBZjNdwYwROFmSoskGi0iHwP51d+umIjHjkhf5BOSKVQwNaJ5cywQ4AMVquyyWaj2Q==@openvz.org X-Gm-Message-State: AFuF++ngGxq/5S4+G4LLcQ81k7s/WV2iSw57eQKGgdC0JaaFz5XKLW1w uKweT1ZHAscpDe5gz2NLrgzAuxNWJIIoFlWeNXXFQmmN4w1B42MjCdQW0LRyumaK3ZHIDDjh6zz Y4UEdytkSQ8Xad6tPU6tMTo6mCsl+nRl9XjF6r/eLGRMRBiI/yBeKEg== X-Gm-Gg: AYBFou3iIHwwgsov7wRJcr6YZmqz/0SRsCuIOdlyizw832bSySvKsAJYGpea5v8Bsje TdCLc+2JDtu/8fyq2E060UkF7wLAOrSeEQrueQ8kUVpKDEx5HBmQm2KNljiNc432voCLy3vWrn+ jD+fDIgmOyE+FTkmsSo8t0HOgiEnuDT7zlaMDWfSEa3j5VfSMusRNxu7pCAcju9HBeCSgaXoGwU p9kDucDs9xCaplY6+984IntIboGfIZTUJJwPZ6sqoQC+unBrgSIu0WScapibiVnwGW5vSxRUScm 1tREjNUKbabP7RAV86cK2RAGp8CVLShGUvPlWN9WSQoHTff2EHtuzLtVGy2qd25b6p4u4ljUimF gyHAg5+L6uWqfUjmV3Q== X-Received: by 2002:a05:6000:2c05:b0:487:27f6:a4e0 with SMTP id ffacd0b85a97d-488716b8cd3mr3742606f8f.48.1790251867503; Thu, 24 Sep 2026 05:11:07 -0700 (PDT) X-Received: by 2002:a05:6000:2c05:b0:487:27f6:a4e0 with SMTP id ffacd0b85a97d-488716b8cd3mr3742526f8f.48.1790251866783; Thu, 24 Sep 2026 05:11:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1790251866; cv=none; d=google.com; s=arc-20260327; b=Lrm8ZeoLaxI6cOsnAuPn7idfuPmmWiCLRcDhKyrW71HDQ36xmXc8RChwtWJ2kh8+YW rop124CIt+pwBHD3tzoMpezYkizSZFOFz5C+LAjubaYuYp8yQCYRhSQulXlXGeQLwTTO LLgI6jn0Xcy9DgNfr/YXTqxFzuwJ0tPvgh+YIK+p9qNX+/R1eh7EhhPsctf6wKXghbEw HMGndOYQzDwWJsmDu+CvkDONzDCN6LUG99ob5opwwCWD1eaHybGMBXcYoPKmYcAnawPG RU1kXv3BGkYCg+f1Wvnmw60xU8AcNL2IPW+F0HAKD97c6K6GWXA4ZbP/Khwr0BH1XWwm URwg== 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=rKMovm4YEZS8zQC1cWpmuFb6Z0HcYwRQ4AvfuxI96Go=; fh=CTF2GHyV+XdzB5TROrdG4fdLri6JSHNOBC+LNuNq5bA=; b=pcxH3AXnXMW1DGwopkrFKtEyeV37GJec+vgZoQIFsSuqdwgMXeBA2+pIxPkzpMmj7Y V67PoA5j34CvfgBAX2HUO3ZdjwnsuwAfnQNPlyoX30amgalC7DD10gXYmkwMmGwUaH8h RpCSMxHefafEXczUbHefJtO0p6eWngz1OyeMaL1QaPwzzO6TcLVuNCL4ctHLXiFd5Mqj wem0dtdDjhADDotnYsLwNfji7u/RMZ8rosKw3wMpK+NUBtL1faEucQfP1+WRE0BcTi2U HN6nSSee/Sw9/f0iYU5AnGd1rA7lpu+A6EFNXGYNDYLF2wZUeCMpIgrwst5mFQnP+8Kj HBCg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=LTdpUQhQ; 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-488688c0b7fsi9498877f8f.239.2026.09.24.05.11.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Sep 2026 05:11:06 -0700 (PDT) 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=LTdpUQhQ; 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=rKMovm4YEZS8zQC1cWpmuFb6Z0HcYwRQ4AvfuxI96Go=; b=LTdpUQhQY6+M uhjoxMQd5eLS+GODIIFnqUUPBVouYo3B/DkV7WXAyfpTphQZuIzeZ0YEwbweFMk7WmF82KpUoq+YY q7wE7PnniiF5lFlvTDHirdYsU87mSp0ySXxEdRejKVfBcK36/LFqELdvSUhLlzvVUCcveE57kNwkC 3o226FBCILF4l+H1hMO+wgejNr21uaKqUdIjqbGC0BRs7jaVblOWis9vUp0xAtbvxt+YfQnhVsqyJ kLth6o9RDlXWOSjJAMXm/VI/vU/wKKH6tVrcJfmWnOMGz22Bo9TEsssTTdhA8o6AAHcg3qIx5XS0Y kPNdzjW9aBCczVP5Zz2fEQ==; 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 1x9iF9-00Dt0d-2l; Thu, 24 Sep 2026 14:11:04 +0200 MIME-Version: 1.0 From: Konstantin Khorenko To: Eva Kurchatova In-Reply-To: <20260831234217.1649428-3-eva.kurchatova@virtuozzo.com> References: <20260831234217.1649428-1-eva.kurchatova@virtuozzo.com> <20260831234217.1649428-3-eva.kurchatova@virtuozzo.com> Date: Thu, 24 Sep 2026 14:11:01 +0200 Message-Id: <179025186193.3195055.17480934750061166750.b4-review@b4> X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3683; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=/H1VO7JdKtQT2Lz1s1JtHChkPKPWuadRvIf8oMN3NfI=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBqtRNZODr/EjD2Rud1o9eBpgR9ZcV6UPy8tpEYm WA3/Q/uTkiJAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCarUTWQAKCRBRlgpH+WFc KlqTEACUVslk8Q8S8HNo/lY9772JvtFwqEHtAGZ1iwQyX7FTKU2YKDI+UbLXV/Lc/cLVAA6JWi1 c/8gI6SYSzfwyoH+m286+JEqd1NCb0hQLRr41wYiVl0CQmRQshmId+SLsqOhJhvTLcp7g0Jhk2L sh0T/ut8ByZJiSBbGvXTPcIOp59B/a6WmLKp6kNLBkv+1UdDD2wm1p1sk5n+MrhSke2JCGVVz1J viNW6fFk5nPYQISc1z8iJvj03xfshx10BbX+LSuh3hG7M5UmMBqbOGeJWFah6qmuieLmyyvbSNu MbYJlpIAnWls0MIArGTp8nE+aPvtPQ6rs6wsZx6SrgACeXrNQzu6gsewcT9/N7Kb3mKe6Va8jNg kPmApJtQhVKDgUQ8LK2+bETC4G5P+z0jBUn4sToB0BXzjEdAHePjz9UF14q+dH0HjsfikaXezW2 ak/EJ+oPZRG+L7zpBTQINHdpru/cAiglZMeHhPqU3RhupMtmvAyjrdXfgzH/rLQNBIjNm8g9w2A Kyg+RXuBLjXC3ThtN3bHxLDDwh05yH+ctZzcqQqHuy4/9PBgB4dOfK354GPXHVpLkTq9qj3cLZS KMvW7M+/f3bF+QrEeOzIOEDB6vT0NRJn8oanwlEDZtpT3ivAVdmqNZ7Nv77NZ04RFfX5oWuhCD5 kACcYOkhu46MrSA== X-Developer-Key: i=khorenko@virtuozzo.com; a=openpgp; fpr=560F6DC83DC5D3D063BD082C51960A47F9615C2A X-OZ-Fwd: true Cc: devel@openvz.org Subject: Re: [Devel] [PATCH vz10 v2 3/5] selftests: bpf: size the map in test_lru_sanity3 to whole refills 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 > The test fills a map of tgt_free * 2 elements and then reads back all > but the last few, which fails on a machine with six cpus: > > test_lru_sanity3 (map_type:9 map_flags:0x0): test_lru_map.c:463: > test_lru_sanity3: Assertion `!bpf_map_lookup_elem_with_ref_bit( > lru_map_fd, key, value)' failed. > > The elements are handed out in refills of lru->target_free, which the > kernel derives from the map size as clamp((size / nr_cpus) / 2, 1, > LOCAL_FREE_TARGET), 21 for a 256 element map and six cpus. A refill > the global free list cannot satisfy in full does not stop there, it > calls __bpf_lru_list_shrink() for the remainder, and that evicts > elements which are still live. 256 is not a multiple of 21, so filling > the map ends on a partial refill that drops 17 of the elements the test > goes on to reference, and the lookup fails on the first of them. > > Whether the size divides evenly depends on the cpu count alone, which > is why this passes on two and on sixty four cpus and fails on six. > > batch_size is already __tgt_size(tgt_free), the refill size of a map > of __map_size(batch_size) elements, so size the map that way and the > fill consumes whole refills and evicts nothing. Start the keys of the > last insert at map_size + 1, they were placed just past the old size. > > Fixes: 5e9388f7984a ("selftests/bpf: adapt one more case in test_lru_map to the new target_free") > https://virtuozzo.atlassian.net/browse/VSTOR-139677 > Feature: fix selftests > Signed-off-by: Eva Kurchatova > > diff --git a/tools/testing/selftests/bpf/test_lru_map.c b/tools/testing/selftests/bpf/test_lru_map.c > index 0921939532c6c..fc67a337d3c1b 100644 > --- a/tools/testing/selftests/bpf/test_lru_map.c > +++ b/tools/testing/selftests/bpf/test_lru_map.c > @@ -441,8 +441,18 @@ static void test_lru_sanity3(int map_type, int map_flags, unsigned int tgt_free) > assert(sched_next_online(0, &next_cpu) != -1); > > batch_size = __tgt_size(tgt_free); > + if (!batch_size) > + batch_size = 1; Regression: the line if (!batch_size) batch_size = 1; breaks the test for nr_cpus > 128. The old test degenerated there: __tgt_size(128) is 0, nothing is inserted after the fill, map_equal() passes trivially. The new test builds a map of 2 * nr_cpus elements with target_free = 1. On the last insert the inactive list holds more than nr_scans (128) referenced elements ahead of the single unreferenced one, __bpf_lru_list_shrink_inactive() never reaches it, __bpf_lru_list_shrink() falls through to the forced shrink and evicts a live key. The model fails on 129, 144, 160, 192, 256, 384 and 512 cpus (256 cpus: key 257 is gone, key 512 stays). Two-socket nodes and VMs with a large maxcpus have that many possible cpus. Suggested fix: when __tgt_size(tgt_free) is 0, print Skip and return instead of forcing batch_size to 1. That keeps the old behaviour on large machines and still fixes 3-64 cpus. > + > + /* The local free list is refilled lru->target_free elements at a > + * time, and a refill the global free list cannot satisfy in full > + * shrinks the LRU list, which evicts elements that are still live. > + * Size the map so that target_free divides it, otherwise filling it > + * ends on a partial refill and evicts the elements referenced below. > + */ > + map_size = __map_size(batch_size); > + assert(__tgt_size(map_size) == batch_size); assert(__tgt_size(map_size) == batch_size) is a tautology, (b * n * 2 / n) / 2 == b holds for every b and n, so it checks nothing. -- Konstantin Khorenko _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel