From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EC523C1980 for ; Thu, 15 Jan 2026 18:55:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768503340; cv=none; b=FGCqag2JxuUAgte5bmqF3OlMZ1nWIDoMJMetm0nbJkCibDhZyiOAGl5bdPrrMHqKK12MaOV6KeB1IQHCrWjKR/huECmLhmu6LJm4T4oYWLP9MzRlYhM2NgV4q4GIkrGe43TTKof+dzSrGMskAaQ1ggO0DkyvU3LFXU62mVHVLWY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768503340; c=relaxed/simple; bh=2wyagbCuDb2DZN7p2UQJWptODEYb/g+9c9stx3410Oc=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=JMha3G1VmlfZ6hHRHcx3Ao/lZTEdAHsClzueWYagtLDalgkiYApX+dn57RSg1DSbk9f7UC8RtMkmMIZW1nhmTWQdayMqpii3zhW8jgPR6YBRDYzMiBJnBVtcE2gxWYSUYdcHVjfiJQnkNfoaU5JCkraLwh64dwaW+2A9JBRN+7o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZrzmBWe9; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZrzmBWe9" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2a0bb2f093aso7435095ad.3 for ; Thu, 15 Jan 2026 10:55:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768503334; x=1769108134; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=2wyagbCuDb2DZN7p2UQJWptODEYb/g+9c9stx3410Oc=; b=ZrzmBWe9sMgw/qGgf1D61W4pPasDjOMsczDDjeMSYSyIQa7CBkTeUCHU16rcQFVDnK lWsILxIDtQtYztEZEQdvRzCHJUo9vBSppD7hPCrFAjndTLLwp6j2kutgJ2RM5iwzpTBv 6POlO3asttTfg30fbIF8w6pBb7y5Aka3VOCap8gqC7IJg+oMtiiv12/w9qk06qTuYghQ MlzY14lWHWm43PZxXxMbF07T8fVr7YlWGkmVtsBu9ylLqLC6Iz3LoZRh9p9a5lls9off TuDoPQpTg1UEJOxpoMzPs/Rzwd+UHi1Sxx6JaVNoIYQcPTjygvZRH3RfmQURnsKckxHp hAAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768503334; x=1769108134; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2wyagbCuDb2DZN7p2UQJWptODEYb/g+9c9stx3410Oc=; b=kN0plH/+DmPMIDlpAkj1ZetMaYW+wknysxL07ttRxPJNXk59rmHMoozUJsvMCZQkUV KXEz8zPwh3kKdjn4AmNxOss5l0LizTcwDMuWIqTK4HtKawIKciaWn7M0e6DJwa3OZMkb IXjNVHQoJYMuG4Dw4w+dqiJ2fMDYaUQ7ABbt1HIkI9fEDSKoZ/cToc7xfVmisBuiVy31 bPDNPXacP+doWsBDnh3qG6eKCLMOTMtXRj09qenyhMy/5j6SRywnqGDDCi/lawbUBheE BXA814/vPdvcqy+SE1/Z1nN9LjdfbAjQNhVtAuhG/NcVhvP1rChhuycwjrSLZ4NZl8gs z1Hg== X-Forwarded-Encrypted: i=1; AJvYcCXHVfLNYAurl1PJZ//TIB5MciIVhlKO5ayM1qUZK1VV4DjFb02S379ai2H/shc9Ti05/LGIFn3zqKe5Sp4=@vger.kernel.org X-Gm-Message-State: AOJu0YzVtCjVXKubCC+Aq22WlaUg75NK2eiCBhvfDznWpv5BjrXX0Vch J6ekee5zYrsWxNJ/lvtGkk8vqgclR7iRQle2fhRgZz1H14wj4Q33/fzi X-Gm-Gg: AY/fxX6zzaD7AzK6jVVCHOOMcFBmNV4B2I1kyDFek1ExOzuv2VTwnn/sZyyF6j8hJ6S mFtKwy09ACJzJ7pmCRYKZj9nMX6YXsVi41AobLhPd0UY95rx8LF0QWDfSyw0yHD3sIgyaFEI4/x o7s0yvSS0a/DSTSY9yqnhOBYO9N7gPc4S8XkowHxzPVlVARYsZ2W+IbxtyQRIzgi+0GzE4lDBWy HCP5W9Z8BTKccadgAR62FdlRyirvtcGl6OzDIl7C/VdPip+ylUxtNwqEYes0zrtejY9ujJiAl3r BbRJaiiSL9GLa++B0adY+HftmlANMobydXwLxKtpNGq4P2USLU5nFUmMnD11yxoKIi0WpUw4vdO kYMuD6TtM/QIkRve04319naeg6+wuJ0D9IGsccsAYTYl1L+2vaEsKXQLkSPdOn7A7t86ZhzweXB qT+7H5dadv1fUQgY+Wn5c4nHZTWsml4OpE+jlTYMaA X-Received: by 2002:a17:903:28d:b0:2a0:89b8:4686 with SMTP id d9443c01a7336-2a7176c6d4bmr4493395ad.46.1768503333829; Thu, 15 Jan 2026 10:55:33 -0800 (PST) Received: from [192.168.0.226] ([38.34.87.7]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a7193fb239sm376865ad.70.2026.01.15.10.55.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jan 2026 10:55:33 -0800 (PST) Message-ID: <7ffce4afdb0e859df7f0f87d170eda31b66a5b2b.camel@gmail.com> Subject: Re: [PATCH] bpf/verifier: compress bpf_reg_state by using bitfields From: Eduard Zingerman To: wujing , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko Cc: Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Qiliang Yuan Date: Thu, 15 Jan 2026 10:55:30 -0800 In-Reply-To: <20260115152037.449362-1-realwujing@gmail.com> References: <20260115152037.449362-1-realwujing@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.2 (3.58.2-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Thu, 2026-01-15 at 23:20 +0800, wujing wrote: > The struct bpf_reg_state is 112 bytes long on 64-bit architectures, > with several fields that have limited ranges. In particular, the bool > 'precise' at the end causes 7 bytes of padding. >=20 > This patch packs 'frameno', 'subreg_def', and 'precise' into a single > u32/s32 bitfield block: > - frameno: 4 bits (sufficient for MAX_CALL_FRAMES=3D8) > - subreg_def: 27 bits (sufficient for 1M insns limit) > - precise: 1 bit >=20 > This reduces the size of struct bpf_reg_state from 112 to 104 bytes, > saving 8 bytes per register. This also reduces the size of > struct bpf_stack_state. Overall, it reduces peak memory usage of the > verifier for complex programs with millions of states. >=20 > The patch also updates states_maybe_looping() to use a non-bitfield > boundary for memcmp(), as offsetof() cannot be used on bitfields. >=20 > Signed-off-by: wujing > Signed-off-by: Qiliang Yuan > --- varistat collects verifier memory usage statistics. Does this change has an impact on programs generated for e.g. selftests and sched_ext? In general, you posted 4 patches claiming performance improvements, but non of them are supported by any measurements. P.S. Is this LLM-generated?