Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 757DEC433F5 for ; Tue, 12 Apr 2022 22:14:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uvj2dgg7BxNYvzaVyJA+v1AtRMgLMUbY8Nzz6XXJOnE=; b=tTec6FtRKL4Wwe viAsImyoZJWbO3vK8rb0OjA2+X9uRHXzo5jDsQhDqmNpUYUI5WEuux8qhlbvN2yHtdCiBmFdssyv2 ea17wJBt8vdMYWzbWNkh0TWmlTkSEVYKLSP8q8IbMteMbrvkHUzcrBd+t+Pk6en/Npr4jmtu2b9wy /AxcGHooGbtuXsKsI6XWfEKcy/1gk/ZmSIylXuGC/nHOJDLcSkJGNPtIq674PgH0tmDNToBLmcd4o R3OYd8p2CHRWHHUCRF/zav3LrhXDOF+sOY0OVWv48mPNxrxkwDfa1zj6lx4rS+npyxCRgsyBn5rsJ Z4U/aCJHwex+yW+94BBQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1neOkg-00Fwbz-E8; Tue, 12 Apr 2022 22:12:46 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1neOkd-00Fwag-3O for linux-arm-kernel@lists.infradead.org; Tue, 12 Apr 2022 22:12:44 +0000 Received: by mail-pl1-x631.google.com with SMTP id j8so237406pll.11 for ; Tue, 12 Apr 2022 15:12:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=3k9hJ+Jr3FLe4plE0QRojfka10o+BEOMUnL9QLr63to=; b=b8xW3Xp4tiUa99A17UvGdiws13S52S4Ph71zVASv0FurDMkVncFYoaQbU6bD/bZBjL 2ltYlsc7ueFUx2aHnVe5j8uFZRxWF/M6qeSfoMhdUddNuBDvWczyLAdtqmpFJaMIRn+C 3gli4kQ0eJgbAcqbiQMqF+mWwweTLI7RLlFoBVKHRY3J2el6BES58xEdBTviXqHW1LY7 g/Wfus459x+a6QxlrcIu457ETAZpoSQyIH5ht6HjaRE95fQuOI9l1di7baN7dVzcPWjo HSwlacoI/Cp4HeY3PKufJESJgb0DTlhl5jlkA6PteFUyrzCGveKuH9wiBafrD7lfu7Dm d/4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=3k9hJ+Jr3FLe4plE0QRojfka10o+BEOMUnL9QLr63to=; b=bXeyW598MOwtbKK9tk4TbOqVWdoDJZmKAifZ0Zj97J2uImCNTLiEN5tHTwK3VauX0L RNDp9MsZtn87fvBN8BNtMbqbVlCScKf4FEcJIVGLzwqF2m7C80ixGForoZ8N4zvZbC+/ oelPsWqqnmX41sV4PD/PqPOdCArRPY3cJ5DG7lUlbCrb6Vt2P0hPrLdps3f317aVG0hd q73q+9TCWIW9kzwej8NAkIu5LsfsbUZEziGggbF3mUFIiipzP7Hu4rUbJicNh05siNIR pZ3QspOJg2WnIITJV59EQgfNhKDO/FIF8Mq4cYXIVaoqLdRBGBr+9oyVcBXLTnYFN7vV LPjg== X-Gm-Message-State: AOAM532BvLwRAa2a8P5Xzend+om/Nt+YjvIROid30rvtVnSU6BPcW/Sn xUoMnp8Niq1ob0edC8s3k5k= X-Google-Smtp-Source: ABdhPJxAGq96zxVDa8TlnhlBWWqOaluWv4i1QWlDCPsTanYp9kd9IyPDkp8V90q/jKHT1oekaxOeBQ== X-Received: by 2002:a17:90b:2685:b0:1cb:6521:dd78 with SMTP id pl5-20020a17090b268500b001cb6521dd78mr7448005pjb.194.1649801559276; Tue, 12 Apr 2022 15:12:39 -0700 (PDT) Received: from google.com ([2620:15c:2c1:200:af7f:9aa3:e1d:b65d]) by smtp.gmail.com with ESMTPSA id u17-20020a056a00159100b004faef351ebcsm38719862pfk.45.2022.04.12.15.12.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 15:12:38 -0700 (PDT) Date: Tue, 12 Apr 2022 15:12:35 -0700 From: Namhyung Kim To: Ian Rogers Cc: John Garry , Will Deacon , Mathieu Poirier , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , James Clark , Alexandre Truong , German Gomez , Dave Marchevsky , Song Liu , Ravi Bangoria , Li Huafei , Martin =?utf-8?B?TGnFoWth?= , William Cohen , Riccardo Mancini , Masami Hiramatsu , Thomas Richter , Lexi Shao , Remi Bernon , Michael Petlan , Denis Nikitin , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Stephane Eranian Subject: Re: [PATCH v2 0/4] Tidy up symbol end fixup Message-ID: References: <20220412154817.2728324-1-irogers@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220412154817.2728324-1-irogers@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220412_151243_198120_88FA2F8E X-CRM114-Status: GOOD ( 17.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Ian, On Tue, Apr 12, 2022 at 08:48:13AM -0700, Ian Rogers wrote: > Fixing up more symbol ends as introduced in: > https://lore.kernel.org/lkml/20220317135536.805-1-mpetlan@redhat.com/ > caused perf annotate to run into memory limits - every symbol holds > all the disassembled code in the annotation, and so making symbols > ends further away dramatically increased memory usage (40MB to > >1GB). Modify the symbol end logic so that special kernel cases aren't > applied in the common case. > > v2. Drops a merged patch. Fixes a build issue with libbfd enabled. How about just like this? We can get rid of arch functions as they mostly do the same thing (kernel vs module boundary check). Not tested. ;-) Thanks, Namhyung --------------8<------------- diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index dea0fc495185..df41d7266d91 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -35,6 +35,7 @@ #include "path.h" #include #include +#include // page_size #include #include @@ -231,8 +226,16 @@ void symbols__fixup_end(struct rb_root_cached *symbols) prev = curr; curr = rb_entry(nd, struct symbol, rb_node); - if (prev->end == prev->start || prev->end != curr->start) - arch__symbols__fixup_end(prev, curr); + if (prev->end == prev->start) { + /* Last kernel symbol mapped to end of page */ + if (!strchr(prev->name, '[') != !strchr(curr->name, '[')) + prev->end = roundup(prev->end + 1, page_size); + else + prev->end = curr->start; + + pr_debug4("%s sym:%s end:%#" PRIx64 "\n", + __func__, prev->name, prev->end); + } } /* Last entry */ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel