From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.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 889DB2E040E for ; Sat, 22 Nov 2025 09:05:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763802315; cv=none; b=nN7x5b3pcyBdQwTAq7G/7hHeiWGN8/nu1VdYGwLEd0twL40hvP7eltRHF1ckoHB01WMnbiDZUfVAq+MmmkFoxjkvj7vHBFkkImiwik/FIfKFxOwONtrsegJGKIQhNkqyDldY5tn66FoMLGTOql+K19ZMpNYyOrcLXcpExAP0rJU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763802315; c=relaxed/simple; bh=Um4UnPbfNFpJnJ1Lns/u56GQ00jKL4b5KxYTpCEB7Ww=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=NgwK4onFF4pf0OqozZGTkrI5YAfTI5Ka2Tya0G4F+XH+0f37bVhnlaApWTw3gXq97n9606Kda15wc2J+6czao2L27ftNdg+8pzF2uOuhkLRly/9kR+p3XRM+fllpj9NGRnCV2jATEkjZZg4zQ+B+pz1J1ZJl1QbK+/987EV2B3I= 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=k/ch9uUF; arc=none smtp.client-ip=209.85.210.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="k/ch9uUF" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-7b9a98b751eso2169462b3a.1 for ; Sat, 22 Nov 2025 01:05:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763802313; x=1764407113; 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=Um4UnPbfNFpJnJ1Lns/u56GQ00jKL4b5KxYTpCEB7Ww=; b=k/ch9uUFQSgIGksmwPVpss0qOKiHEOIoWr1X4XsdzP7D8VYHXn3zazjV1OZJM+ywVZ /BJpW4JdRjBN9TUNRGyCZE64ywE8NTeSnmp4yOmmahHOghqBNySNU9QYaHg52Hu86gnp g+2bmHyVuHpZg+aF5Sid8uji+gCzegu8Erfh4h6jUV4n9FhM15dtRhDUSz9xHyA1vP4w X9bokvSXzwwZ6YmZ6r66+ajfC4Vy3REjhi9dGP63dDOHgl8IySA0UhYaI3TogHxQRSL1 4NmLasZhRzJ6Pft1G4lI8iTpe1HdPY/UmetgBib+Sq0t0KYghETcQI8Tm/5dv4d92+Kk u5EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763802313; x=1764407113; 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=Um4UnPbfNFpJnJ1Lns/u56GQ00jKL4b5KxYTpCEB7Ww=; b=NNJ8WtpKaoZOL6Jd1zf2vszOEd08t5RzfD5n3AO1l6FeAGxsoULab4+exfLGAS7ypQ hdR3DNkaVEwzrhDpf2gxwz69bwkb4ej9K6K/EKqy3t92DAM7mjNL8PtYBsXJEG1WF5fU VFpmPhCPSG7YXTZKITi0GiZcQkjoQxDZAH7C5r/X8TRrVgPQ5FaeV1l8Zabz/01r2xv1 hUeskZA8FNCRarjjzg2Pbuup/rWqugrwuGunP6Um2ox1QW3zV7r5RPj/dS49qSFkFlwx dl/cwWxypj/9mvLNDv8c0hOyUFZt37+19F1XK4mNeRsN53sgP+f7IZ8C0CdHCMllQmUS yX2Q== X-Forwarded-Encrypted: i=1; AJvYcCWIHPuXNJCNZLoND85epV11BlEqjendfwUMwTO6OYE9H16e2BZqX5vAfgBzOqcqENIYRr1+tDWyfn0xE6o=@vger.kernel.org X-Gm-Message-State: AOJu0YzF+S18GKROg3D/y6XESFnvAUT3Go6ghVqkN2OuXG42jj2KK/a3 2kJyXV3jjNj5rlcxvAI432HVkgGKRIa3GxKqkAMf/4Q+RhXW7y/l2MF7mqEr8A== X-Gm-Gg: ASbGnctJ4+WDj3pb0EkrnuD2sPhDP9Xr6j69P2XfEZVOtCa1H7xeleVeIxeIdl4polb O5G7mO0N7FMos+F0GCaX2BcWaJP7kt+Xmz8/4a/w5asPU1ge7u9N1/a3OIivuLq60UOcLf+rDZw t1G0MCtYo4k2Ff1GdSk0uAInwU+UN/cMM5fcQbQehB55FTNzUvK5ZaZqrKpo7+4NZ/L2lWlwxhb Eaa/E2CTVjwxvVJ1aXC8EWTfGIv6XdIaYdjFtz7D2GFySBJ4lmBUKwa48Vk21m/gcBb/quhjaph LIsobN7a429IjCUhLWWLurYuT9xd8+vm8AkgmOWIJlLEzL+iDlP7ry20jvxPaYhtfJOupwkVCOv il84DK3TYtCXfWLX/Nx9yaYuvNbeL2EkFjIggMFumLBlYlH31HooX0c5NRTMUo1xQDp7KyM58Xp lzVp7ytuE= X-Google-Smtp-Source: AGHT+IFUab76b1PQE4Jfa8RjCTvQiCrsvEsvVg3FMlD/dO1BErN8i/ili2DuOSAeQ5Zi3rpOLBGypg== X-Received: by 2002:a05:6a20:e291:b0:345:e30f:d6e6 with SMTP id adf61e73a8af0-3614eb9eab7mr6869367637.15.1763802312773; Sat, 22 Nov 2025 01:05:12 -0800 (PST) Received: from [192.168.0.56] ([38.34.87.7]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7c3f0243b19sm8435596b3a.37.2025.11.22.01.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Nov 2025 01:05:12 -0800 (PST) Message-ID: Subject: Re: [RFC PATCH v7 5/7] libbpf: Implement BTF type sorting validation for binary search optimization From: Eduard Zingerman To: Donglin Peng Cc: Andrii Nakryiko , ast@kernel.org, zhangxiaoqin@xiaomi.com, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Donglin Peng , Alan Maguire , Song Liu Date: Sat, 22 Nov 2025 01:05:09 -0800 In-Reply-To: References: <20251119031531.1817099-1-dolinux.peng@gmail.com> <20251119031531.1817099-6-dolinux.peng@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.1 (3.58.1-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Sat, 2025-11-22 at 00:50 -0800, Eduard Zingerman wrote: [...] > > Thanks. I=E2=80=99ve looked into find_btf_percpu_datasec and we can=E2= =80=99t use > > btf_find_by_name_kind here because the search scope differs. For > > a module BTF, find_btf_percpu_datasec only searches within the > > module=E2=80=99s own BTF, whereas btf_find_by_name_kind prioritizes > > searching the base BTF first. Thus, placing named types ahead is > > more effective here. Besides, I found that the '.data..percpu' named > > type will be placed at [1] for vmlinux BTF because the prefix '.' is > > smaller than any letter, so the linear search only requires one loop to > > locate it. However, if we put named types at the end, it will need more > > than 60,000 loops.. >=20 > But this can be easily fixed if a variant of btf_find_by_name_kind() > is provided that looks for a match only in a specific BTF. Or accepts > a start id parameter. Also, I double checked, and for my vmlinux the id for '.data..percpu' section is 110864, the last id of all. So, having all anonymous types in front does not change status-quo compared to current implementation.