Received: by 2002:ac2:5a04:0:0:0:0:0 with SMTP id q4csp1079038lfn; Wed, 23 Feb 2022 18:32:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxihOO+yrTKbd4dpEA9RA4a+i6AD/UvjqqjaU2u9cPtwjaD6HgDJFC8BwhbfwNHyNMNXmUL X-Received: by 2002:a17:902:b185:b0:14f:2d94:184 with SMTP id s5-20020a170902b18500b0014f2d940184mr478433plr.56.1645669927687; Wed, 23 Feb 2022 18:32:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645669927; cv=none; d=google.com; s=arc-20160816; b=awaf8lJwEoz9I7nAAGcDH9LN+yfbwRQy7nECXjLg24PY6YHVPVqbGRAMES+pBat9U+ Mbo9KoWymMcgqSKWLvNcMwjLfF0yZ0DvhAOPsO/md6DNpvWTIv7+fdSZbDdD5huWjKqd Jak6U1c6s5UOH29xh9Gcb+TaJ1NwjduzfQoEVneF0s1uqqdW2g6ENLrixPP5ruq0O0vv BvKZO5hpDRWwfMevJyebTMcF9HHknuCefV88DsqFFbl+MC2IaJKNk/PtQXvOHK+PPFjO C91s2pmeNiH0CmuH+/o1ASm6K1to2556zQd94UDrhRFDdbkLpTFUMDkUaz9Nsgpb3cbv Th6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=35h6CX91aZ4xLwAScKOmp4ZeUdk2iLJq6vdPAvKxmQU=; b=cwrkeij4LLNg5wH4mvtZu2hlIAjxTGS3iWya1g21eS29gLJw/UzZkgkMQ3306hCRaB ohpVd3PNZxf20pCji1BQizAmGts6c/SQVXKwRsI+YSwXtuj76fke88AjFKVgIm9zUrrs N3kBPZfDRM6cWV/Ud/WOrQ5Dy4k45FCkywnA8kmKYTR1wmSart1s5529/EcR7UZfSZTN zKgq+kV0PC/h6lNhN9rOs186U0XXhQ/oOJXmz492kwoFb0QY2PhowpPyXil0+D7dM7+M FyI+BXLhA07cSEMqHC7wVcc9Is1474dluW778eTSTsZHUNn8aauAaJudzKW9lagg4rQF /M3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CS5MrlX3; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s10si1440373pfg.171.2022.02.23.18.32.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 18:32:07 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CS5MrlX3; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0C1B11A39E1; Wed, 23 Feb 2022 18:31:34 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230107AbiBXCcA (ORCPT + 99 others); Wed, 23 Feb 2022 21:32:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230077AbiBXCb6 (ORCPT ); Wed, 23 Feb 2022 21:31:58 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B0572325F3; Wed, 23 Feb 2022 18:31:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 129A86159E; Thu, 24 Feb 2022 02:31:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BEBCC340F1; Thu, 24 Feb 2022 02:31:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645669887; bh=35h6CX91aZ4xLwAScKOmp4ZeUdk2iLJq6vdPAvKxmQU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=CS5MrlX3vvqBeU1jrlmDo+KtjGv6TsJEeSuC3LeP7tq+l1Pc4pZb9EhlHzdfj5LqT WeprXJkAlSe/Z9lBpoijYWpVWEj/nQ+FKl/8CaU4MpqZl7bzYjHwoBZ74Gu0wgx9yZ xTVd181hQTK01u3e9pYKQOsZ7LPVm+miTsij595/Ot/ULHHRDRC2uXvN4lOsyYGSaB /RiDfO1t5qsnDjyi0r4wBiLBOdeq3NVMusGw1tFm+VhEPCkZiI0wOvhLuMxMB4cqgb 4dZyxJJahoZzcHl+hGSJGammk1clFDzaXfxahc4yOzmlel8OL3SeA7l5LFCyFsSyOn MWjvcsfNP9c0Q== Received: by mail-yb1-f173.google.com with SMTP id b35so1030387ybi.13; Wed, 23 Feb 2022 18:31:27 -0800 (PST) X-Gm-Message-State: AOAM532F/Y7tV+UkUd++sXF8x/98F8fNLEBVthxe7Wyc8V9ggDN5lubg Wim/z86Nibwqn1faxUoyV/Uv2ENDpHNwAswAIYk= X-Received: by 2002:a05:6902:1ca:b0:624:e2a1:2856 with SMTP id u10-20020a05690201ca00b00624e2a12856mr571208ybh.389.1645669886532; Wed, 23 Feb 2022 18:31:26 -0800 (PST) MIME-Version: 1.0 References: <20220224000531.1265030-1-haoluo@google.com> In-Reply-To: <20220224000531.1265030-1-haoluo@google.com> From: Song Liu Date: Wed, 23 Feb 2022 18:31:15 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH bpf-next v2] bpf: Cache the last valid build_id. To: Hao Luo Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Song Liu , Namhyung Kim , Blake Jones , bpf , open list , Greg Thelen Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 23, 2022 at 4:05 PM Hao Luo wrote: > > For binaries that are statically linked, consecutive stack frames are > likely to be in the same VMA and therefore have the same build id. > As an optimization for this case, we can cache the previous frame's > VMA, if the new frame has the same VMA as the previous one, reuse the > previous one's build id. We are holding the MM locks as reader across > the entire loop, so we don't need to worry about VMA going away. > > Tested through "stacktrace_build_id" and "stacktrace_build_id_nmi" in > test_progs. > > Suggested-by: Greg Thelen > Signed-off-by: Hao Luo Nice optimization! Acked-by: Song Liu