From patchwork Wed Jul 19 07:51:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13318466 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7194C0729B for ; Wed, 19 Jul 2023 07:40:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 38740280036; Wed, 19 Jul 2023 03:40:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 30E9D8D004B; Wed, 19 Jul 2023 03:40:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C5D2280036; Wed, 19 Jul 2023 03:40:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C559E8D004B for ; Wed, 19 Jul 2023 03:40:13 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 784A8160196 for ; Wed, 19 Jul 2023 07:40:13 +0000 (UTC) X-FDA: 81027563106.19.361CEF1 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf02.hostedemail.com (Postfix) with ESMTP id 177BA80019 for ; Wed, 19 Jul 2023 07:40:10 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf02.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689752411; h=from:from:sender: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=5cWrWwlManqrudfdOvGGdBUURxPlu26h088SbWtIKGE=; b=kZ4EfaZjCbCoD3Gk5X/ZtIbOqvFWslt31GTzrOGlWltWjiVjqqicuEWXDu/tb8eYKqdzQq KleJTsLmVCZW3PVgwEsV4Nq9yztTODnzBuUrrSl/lX5vGVTK3rY6i/Dq4f5nkAgUUr14W+ OO5qSj4RdxdbuwQGVBlLDBkAKJO1SW0= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf02.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689752411; a=rsa-sha256; cv=none; b=kX/jF7AK7MrLggGxBeSFWPcnv5GYhiZwEBvX+R8aSBCiKQ/0xPaHA4MWmU/DViFyMnGwxO Lbai69eCcgHao0As8AqfZAq4yAu+tbI/Y35Hd7tDrsPoSXIS+T2pNUxKrxqd6XrOs+bXNf x94OkPf5U1X58OTDctEAi8ML2BatcFg= 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 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-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 177BA80019 X-Stat-Signature: ccnsz1ejj39jrkbgfedpimbr74xjd6gf X-Rspam-User: X-HE-Tag: 1689752410-444394 X-HE-Meta: U2FsdGVkX1+ijOKRD1OUjHrkJL8VA3UiyNYH7IGtNxqTIEG8FpHrNVpDBYoEpODL+gEix/qlTYyixpM3b38H/0ST2Gquk8fuawRmIVprfgPHmudFcjFvSP5whZu79dFxP9rFVlssjtOVzCrN5nWa0LaRs6eZWALITaNmdUWjTIqCswR7na0Bwu9UyuKIOPID/e3CkVzbCTgqi9aftfyKqlFX7lX52ITepc1I4v1ZVfqsB8KBtyF2YXOI4cszIqQ9XN8enuHCSTdaKGeoGTm4zm9B/E5Gfjh5FVk4IgEe7BDdDfPprl0Jjv2B/qij2TIanxl8y3jm+PTXwiuK3Aj6TrPehI92Feqy2anTlgB8C40Ut9f4UmjWco8cEPSipMTjooadBZ/MR2p7PF9M7+8ACQ/cR98HTu8UtaS9mMD5+vBtx3HMXKptmlbLT0UE6KVyHUf68zmxP8AzJpCg4g8N76Vj3XsJIfw0silO6ee7+ihgywbwI9OD/jq4xCGmfHAHoDZmOgiTSSP8bMmqo80FGU10MP3BWYNUJQ3YuD78Ftp5VOebp+wutlMeScn7pbgDBs7KttukGhvpPG6qARcCrJIDQ/u52WHeY0xjxON+Cb9slxCHupgmKZQGzfGyZ5jDLlKApydkyvlzMKzWzR84bWotFAE1cz4vCkg9hqffdMoEFGtsUM+Rt/H3FdxCy1bb9eaC2juug9kT5q+zg0TFRmseS1uXIuT4QrPNVt3yblv2QJzmJ75jd9WpzRA4zYvCMmJJxAigzULjMFgp3UQ0D+7a5fPcsDTNpcJtIxi0GYghSfWDh55LZtMTgHfCqoZuMF4saTWeM7qJXRX1dOv1GJutNU+o5aINTpO9hf5qOGIt32bqWVh7y3MlZb5i3lea0/9HoehjIdVraGfhxZ3ouzfhcDXu6P2JTMvShN5AIOCjy0Pr5vCiDoRKHCDi1lMBEUguAwRF0CMXd0wi2x2 zY0kso9e MklfhvEgBhX4ibLZkN7BuaG5Peovwo+yyLYlKVkcAOrGCadlSSmSDZmKUS/zJYKW20bLkLoSEv65XC/NeqkdhHhYjSFuxk/jEGrnCxljgM3VSW6VE8CG5FnPx4pGdnFiSSJTOihArNplryrkchDWPW8NIQ03PQ3ckVNJCOpfyrhbNiS99JUyhoUwtwAFnBHZ+tGKvQSwtigLOgfiO9C2tr6grOa8mf7Guy5VdRSXly4cZWCfcFchUhoK0xEgzZ5GyMNKnXe+kPMh751HFal9Eqj7xydKt11cSHyhJwdXTXROBNkLoTmqqVNgzAQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Reviewed-by: David Hildenbrand --- 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: