From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796310941; b=TGBqNNbXXc7/ENo4we87aHjhdtslpNsywZKuzK4yztkHkV7Mp233a2vJmeY88SIFFQu4 ynrhLqpI/MZgzZFGlHRyKH/58RGYXGTH6w56eoADZiWR8FIDaNKJFuJFllpMLuSRPDCzt RIy8dlxPop4K+/ivYCU7ejnIthLcFy4Yv/9wdbqcxOhA/g0h+OveIGjG24LfPhHuUGgVH xoknpFdWtdUv+dPP80eERfaK+UGjhGsK5iO8oWFVjmExM5Z9ZIQmNCosHn1BwyRs3QrJ5 adgnEtHrAoeeZkve5Fmh54U6NXz5/0K655gQ+9hQ4Fyo1avtuvly5rgdTzVYXgTFlNA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796310941; h=Received:DKIM-Signature:Content-Type:MIME-Version:Message-Id: In-Reply-To:References:Subject:From:To:Cc:Date; bh=pZdOEt2vCwreDagRMk7Z2ergusZKm1GcBklNr/cHj0U=; b=Nm4pcWZcVBNx7BMrLXEjq6SWaDv9QZq+ubAKIprCMUZzAEUmv2nBjlYfVFGNG6bcyoeL HlD3fUn7LHw92jQaKNrvSNAHWM38D56mIo6rC9o4qugJbSyROsTQvxJ/KU8ZyaFKpVUWU Y5HRodlA4l/yhoUsMPF+qZHkkVVVVI7bSCcZqC6BrNOT0m31ctEqffI7Omm0hTEEQkhOL KwNAebexHME/4LtclYycuUP+7vn4HmxvT4YSQPvVkSBnVie/OWKU7SYWkotGpjYP5A0Bu kot9VjiFN5I/m1MIWwVIkPwttxPG/TId6HciiVbOzf/L2uyCv9YeXjeszGP393dePhQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RqmFUhfR; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BF19606A322; Thu, 3 Dec 2026 15:15:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RqmFUhfR Received: by smtp.kernel.org (Postfix) with ESMTPSA id 110041F000C1; Thu, 3 Dec 2026 15:15:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796310940; bh=pZdOEt2vCwreDagRMk7Z2ergusZKm1GcBklNr/cHj0U=; h=In-Reply-To:References:Subject:From:To:Cc:Date; b=RqmFUhfR1L6SpkYy2O7YU3gcSkbBq/1V51ENpiKc+NDS9qPXLfEXqJBN3LUstuAYg Ai+qeT/oqAz6nU8xF9sb1Jq1bMUTOkpL0vitpsbAzCF6omLYmvwrl+LBnshw4dfqFA +XuFbee2oHB/hFTemzLRymtedELJjBTWjbiyPqgAdTJQKYExqDm5HuCdGHpPU6F9Nu jpfa+JyPGBZ2Qrt6QptkG5V7M9xoKKz6e+DsFC7Jm6frxyipq7L+Th6G977lbgYEb3 1Xl7Mf07vDhg1tQ15fLzDCoLbUSNzYtto4oSbveiN//ypNmahi0JxKUGep0NwzxfIi B+eAnTODo7rpw== Content-Type: multipart/mixed; boundary="===============2877534546093709418==" X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Message-Id: In-Reply-To: References: Subject: Re: [PATCH bpf-next v2 2/2] bpf: Reduce branch predictor flush and move it out of pack_mutex From: bot+bpf-ci@kernel.org To: xukuohai@huaweicloud.com,bpf@vger.kernel.org,linux-kernel@vger.kernel.org Cc: ast@kernel.org,daniel@iogearbox.net,john.fastabend@gmail.com,andrii@kernel.org,eddyz87@gmail.com,memxor@gmail.com,song@kernel.org,yonghong.song@linux.dev,jolsa@kernel.org,emil@etsalapatis.com,puranjay@kernel.org,pawan.kumar.gupta@linux.intel.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev Date: Thu, 3 Dec 2026 15:15:38 +0000 (UTC) --===============2877534546093709418== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit > bpf: Reduce branch predictor flush and move it out of pack_mutex TL;DR: Commit message only: it doesn't explain why eBPF allocations no longer prefer dirty space, and it states the dirty_map/bitmap superset invariant three times. > bpf: Reduce branch predictor flush and move it out of pack_mutex > > Currently, predictor dirty tracking in the pack allocator is per pack. > Even if all chunks allocated for a cBPF program are clean, a flush is > still triggered if they come from a dirty pack. > Switch dirty tracking from packs to chunks by maintaining a dirty bit > for each chunk. The basic idea is that once a chunk has been used, it > remains dirty until it is freed and a subsequent predictor flush > is performed. The dirty bit is set when a new pack is allocated or > when a chunk is allocated to a BPF program. At predictor flush time, > dirty bits are cleared only for free chunks. > Therefore, pack->dirty_map is a superset of pack->bitmap. Every bit > set in pack->bitmap is also set in pack->dirty_map, while bits not > set in pack->dirty_map are also clear in pack->bitmap. Thus, zero > bits in the dirty map indicate clean and free chunks. This makes it > easy to find clean and free chunks for cBPF programs. eBPF allocations > are back to first fit, they no longer steer to dirty packs, as before > commit b72e29e0f7ee ("bpf: Prefer dirty packs for eBPF allocations"). > Additionally, bpf_prog_pack_alloc() flushes branch predictors under > pack_mutex. On x86, this involves sending IPIs to all CPUs to perform > IBPB and waiting for them to complete. This is expensive, so move the > flush out of the global pack_mutex. > Suggested-by: Alexei Starovoitov > Signed-off-by: Xu Kuohai This isn't a bug, but could the changelog say why eBPF allocations no longer prefer dirty space now that tracking is per chunk? The paragraph reports "eBPF allocations are back to first fit, they no longer steer to dirty packs" without giving a reason for dropping the preference added by b72e29e0f7ee. Also, the superset invariant is stated three ways ("pack->dirty_map is a superset of pack->bitmap", "Every bit set in pack->bitmap is also set in pack->dirty_map", and "bits not set in pack->dirty_map are also clear in pack->bitmap"). Could these be folded into one statement? --- AI reviewed your patch. Please fix the bug or email reply why it's not a bug. See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md CI run summary: https://github.com/kernel-patches/bpf/actions/runs/47131842365 --===============2877534546093709418==--