From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [91.218.175.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 793F8157487 for ; Fri, 15 May 2026 00:27:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778804879; cv=none; b=fCSBL4c5KITxceUcvpz547ZWxwGbdfAjWdavug7rZhC2vJ4rYzcqaEP9f7Lmn2KaZO33eSmnxBQMT9T/UHSpQCaT4e3el4WmTI3GU31LP/3PTCMTSXdxYSCBUVqPLMltKGlXd0X9Rxqfsr0ZhI3J9bZSnVSQKq4GuQ1C+Xujp8c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778804879; c=relaxed/simple; bh=lrNAo5o5J32vSMC/U45YIP3FUzp4KMhFYNSZ+pBLktg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=DWXBIVfbv0f2ERTM0xs7QYhRe1Y1bEfodhWrSpc6QG0VwOq4868c0I3uSKstVLqUZMt+v/arnY1AQJPTfqmG2asyurQGtR2IL79MuaJzxg3F6m+23GODEfxE+A0TH8Dv+261SWRY/vTwphZG0t1imBq7ONgyc5YYxGMtkWodvI4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=AFWgePAk; arc=none smtp.client-ip=91.218.175.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="AFWgePAk" Message-ID: <1bfdbc2c-0913-48ef-ab8d-8021e0944884@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1778804864; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GbNeWSuRNX1d1NVzpudKnFGDqs5n3rgMzCUDqnC/7gk=; b=AFWgePAkncPUwd3BzTBfBsF9ipzJxHEXT3UXsxVobULreQX5+uMpnVXPdp6xqnJH0WPJ5G 2SMu69Em147SO8AUZkOCcc8d+8NHKPaa0NMlnY/YPctLMx4gBg5ogVuyQud3AsQWhKh7Dw /G4ToWMn0hUQoFSXWsEjH9241D1+ils= Date: Thu, 14 May 2026 17:27:38 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH bpf v4 3/3] bpf: Cache build IDs in sleepable stackmap path To: Alexei Starovoitov Cc: Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Eduard Zingerman , Kumar Kartikeya Dwivedi , Puranjay Mohan , Shakeel Butt , Mykyta Yatsenko , bpf , LKML , Kernel Team References: <20260514184727.1067141-1-ihor.solodrai@linux.dev> <20260514184727.1067141-4-ihor.solodrai@linux.dev> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Ihor Solodrai In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 5/14/26 5:24 PM, Alexei Starovoitov wrote: > On Thu, May 14, 2026 at 11:48 AM Ihor Solodrai wrote: >> >> Stack traces often contain adjacent IPs from the same VMA or from >> different VMAs backed by the same ELF file. Cache the last successfully >> parsed build ID together with the resolved VMA range and backing file >> so the sleepable build-ID path can avoid repeated VMA locking and file >> parsing in common cases. >> >> Suggested-by: Mykyta Yatsenko >> Acked-by: Mykyta Yatsenko >> Signed-off-by: Ihor Solodrai >> --- >> kernel/bpf/stackmap.c | 56 ++++++++++++++++++++++++++++++++++++++++--- >> 1 file changed, 53 insertions(+), 3 deletions(-) >> >> diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c >> index c1e96df360c3..8a18c9645933 100644 >> --- a/kernel/bpf/stackmap.c >> +++ b/kernel/bpf/stackmap.c >> @@ -226,13 +226,33 @@ static void stack_map_get_build_id_offset_sleepable(struct bpf_stack_build_id *i >> .vma = NULL, >> .mm = mm, >> }; >> - unsigned long vm_pgoff, vm_start; >> + struct { >> + struct file *file; >> + const unsigned char *build_id; >> + unsigned long vm_start; >> + unsigned long vm_end; >> + unsigned long vm_pgoff; >> + } cache = {}; >> + unsigned long vm_pgoff, vm_start, vm_end; > > cache logic cannot go into bpf. it's not a fix. > So either drop it or the whole thing into bpf-next. > Which is probably better. I'll send a v5 targeting bpf-next shortly. Thanks.