From patchwork Wed Jul 12 14:38:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 119221 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1191614vqm; Wed, 12 Jul 2023 07:31:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlHNWVUMdgvOuhhIfGsW1Ikt74NKXRCmZ2wIbkR5W0t/1mUkXVO6mbD8zoGM6zQzWl8A4D9c X-Received: by 2002:a05:6a21:3292:b0:12f:3be3:f922 with SMTP id yt18-20020a056a21329200b0012f3be3f922mr19114130pzb.35.1689172267558; Wed, 12 Jul 2023 07:31:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689172267; cv=none; d=google.com; s=arc-20160816; b=JPT90s+7ePlG9N6lLirJKIzIFs/fp2SJcRN0w6SStt54Cr5FU0G5UwFCXHWEyRldgn pcdw1oFF0bqtYiiFPh7xPP6a4Yn+0m6ov6KppNBEmffF4j9jsjgn+f2d2j6EEzTHq5lV BWVSU6srvSAkORsnL8GV+IuGngZFqFBE7jVjZAjd7tgRIRbbPpdz8/WEpnzWPK7UU992 viuNXmUlZk2aS1kp7AnO72O6+0oTggY5UuN2UlbQljWMEMsgdcAyumaaF6U7oBfGGza1 PKIA+wJOpRLtnulUuSY5c4sX8sBEVYRz7r2u+t8XZzMhxg9s8XbP2arGlsY6oq+VVUPX bdgw== 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=4gJ3MZTpW0hnkqSksXaUK+M0JeoB0I0+1zt0kSd4N4g=; fh=FRon72YwFeIVU/LlfmPNxuVFiduvQKfa+Ydvnh8xLfc=; b=x/vd/o/xkh6g5DU91+1xBocMUn5hamzQAEl7VvKrq6Ge9mqYU0HAYgpYqlOv0N9ODk w9RCAGhgp3CDVVgCmL4NAaJTeHZqA1x6HaY4sMJvaJ5IX+tJf8X4C583d2oMzQqv+avi HYmILgIjaIH7kZmIQxp8jLEHIe8C37rBsSqxKVC2PN7CdCJWbuBAL57z5EJyVBFC02i9 M9yngucFwPhIKE7N/tUOgYEXOzn7HZSepIdF4Ar5B3qFJgTvDHkBsoP/Pm3wci9i1QXx 4l31vDKVQsXVclEXUF29zjpoRrq3zc9zjuxjzZsWE2WK32CnzQ8xB3TG7LOcwibTPsNG TZfg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x71-20020a63864a000000b005575419ff14si3369593pgd.724.2023.07.12.07.30.41; Wed, 12 Jul 2023 07:31:07 -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 S232550AbjGLOZ3 (ORCPT + 99 others); Wed, 12 Jul 2023 10:25:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232359AbjGLOZW (ORCPT ); Wed, 12 Jul 2023 10:25:22 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33B541BC1; Wed, 12 Jul 2023 07:25:17 -0700 (PDT) Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R1Kkc0gYvz1JCRg; Wed, 12 Jul 2023 22:24:40 +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, 12 Jul 2023 22:25:14 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , , , Kefeng Wang Subject: [PATCH 5/5] perf/core: use vma_is_stack() and vma_is_heap() Date: Wed, 12 Jul 2023 22:38:31 +0800 Message-ID: <20230712143831.120701-6-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230712143831.120701-1-wangkefeng.wang@huawei.com> References: <20230712143831.120701-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771225499849397472 X-GMAIL-MSGID: 1771225499849397472 Use the helpers to simplify code, also kill unneeded goto cpy_name. 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..cb271f449b81 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_heap(vma)) + name = "[heap]"; + else if (vma_is_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: