Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7855391rwp; Wed, 19 Jul 2023 01:02:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlHUwL4mr6UNdNf8R04YPLwigWdGBo5t4HwuV7kg9v0A0TaAckQuEER3t+lAz//eQzHo7Ye+ X-Received: by 2002:a17:90a:644f:b0:263:1f1c:ef49 with SMTP id y15-20020a17090a644f00b002631f1cef49mr2010446pjm.13.1689753746237; Wed, 19 Jul 2023 01:02:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689753746; cv=none; d=google.com; s=arc-20160816; b=ayCCl8kWPGg/m9u0ENgsj16bxTRtc5LlqXHcirxayD6PTbbEy56c5gn0+Upf1vYQYB OnOWch8kxYxF7rbfeeJLNSC9XD5ts0NtQb54Ua+MtmUIMK+ykuHaa+AsJheKXqgV3qWn iO3sQuOP5YwUmsWIle9MANO8Eep0jiAKT+qQ2un8501AzidIuVcrsShhxerD1EMeAoJ3 cuQamg2cc5jhH8F+MCZrdnCAqXiDOmje6ioWTgfx0a+NgybrSQ3XT+HEeimpScQ1KVCt YRrOd18yOtc6mnwVKSQzKjqYyKtAePpkIrbCif08gT0XZcq0TI+NSchOdhq3xIiF0mlw NhfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=5cWrWwlManqrudfdOvGGdBUURxPlu26h088SbWtIKGE=; fh=N4J70hJn8skiBpfYtsw9ilEiGztepr9OGmrCWjv2bPM=; b=l4UFD/hNVqcOCahGoSx70dxbOZRe+iobUusqdcUrMuDyHHrJLKZ9St4qQOjujdQS99 KIB5qaJJL26afTOKebmMqxSJnTb8el2ZKzHOZiTDZZttKPbHs+LgsvUWB3SiTJ+AE4Kn lSjDihplu4ulcCfHfI9k7I6CXwU1jfFZCnUU+csDcsUa9xBmLgIzYk9LtZA4SYm/XG4k PICCjQ6bPb3KuxBXJYs6iWrtXTnDiYUZmBj5eBtQNfdlP67Ig2w43vgsGw3QSu3kwyrC AE7nzyYcjJ9zTXusj6NarwQjHQzZcl/oU1p6tCBXGQPzXGcoliiJixlwQiphddWDdtkg V8qw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p17-20020a17090b011100b002635333de96si978025pjz.97.2023.07.19.01.02.12; Wed, 19 Jul 2023 01:02:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229478AbjGSHkU (ORCPT + 99 others); Wed, 19 Jul 2023 03:40:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbjGSHkI (ORCPT ); Wed, 19 Jul 2023 03:40:08 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0CED1FC4; Wed, 19 Jul 2023 00:40:06 -0700 (PDT) Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R5SPj4kq2z18Lgs; Wed, 19 Jul 2023 15:39:21 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Wed, 19 Jul 2023 15:40:04 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , , , Kefeng Wang , Peter Zijlstra , Arnaldo Carvalho de Melo Subject: [PATCH v2 4/4] perf/core: use vma_is_initial_stack() and vma_is_initial_heap() Date: Wed, 19 Jul 2023 15:51:14 +0800 Message-ID: <20230719075127.47736-5-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230719075127.47736-1-wangkefeng.wang@huawei.com> References: <20230719075127.47736-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Use the helpers to simplify code, also kill unneeded goto cpy_name. Cc: Peter Zijlstra Cc: Arnaldo Carvalho de Melo Signed-off-by: Kefeng Wang --- kernel/events/core.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 78ae7b6f90fd..d59f6327472f 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -8685,22 +8685,14 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) } name = (char *)arch_vma_name(vma); - if (name) - goto cpy_name; - - if (vma->vm_start <= vma->vm_mm->start_brk && - vma->vm_end >= vma->vm_mm->brk) { - name = "[heap]"; - goto cpy_name; + if (!name) { + if (vma_is_initial_heap(vma)) + name = "[heap]"; + else if (vma_is_initial_stack(vma)) + name = "[stack]"; + else + name = "//anon"; } - if (vma->vm_start <= vma->vm_mm->start_stack && - vma->vm_end >= vma->vm_mm->start_stack) { - name = "[stack]"; - goto cpy_name; - } - - name = "//anon"; - goto cpy_name; } cpy_name: -- 2.27.0