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: 13310440 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 90E3AC04A6A for ; Wed, 12 Jul 2023 14:25:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BC0906B0072; Wed, 12 Jul 2023 10:25:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B70B86B0074; Wed, 12 Jul 2023 10:25:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A39AE6B0075; Wed, 12 Jul 2023 10:25:22 -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 958D56B0072 for ; Wed, 12 Jul 2023 10:25:22 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 719F98022D for ; Wed, 12 Jul 2023 14:25:22 +0000 (UTC) X-FDA: 81003182484.20.1B46A45 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf08.hostedemail.com (Postfix) with ESMTP id 31CD6160019 for ; Wed, 12 Jul 2023 14:25:18 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.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=1689171920; 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=4gJ3MZTpW0hnkqSksXaUK+M0JeoB0I0+1zt0kSd4N4g=; b=IpmcD0bGbvc9NuwJcyI/CDP9bDNNdjBIfFPVDcTt3OjUlUww361wYrvgSt2bGlsFvbuiC/ pCys6FwFpbxWrhnfrBDX7y2V5IziuPwlKlWpflMQn07zwgqr/cSD9JiQAjKLYyRwXmW9rH Y8yHvqaIlhj/IkBEWkwqSy2SSb2B1AU= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.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=1689171920; a=rsa-sha256; cv=none; b=caTrt+6c+66UR5Sef9Q+JnvO0bUjZdz6v99fL9UBMmOrJyo9/zUFzQtoy74ojOc2YxLKdM Z3YWZgVW+VdWEikltU/DHBwC+yPEr0YQGo00Fls6Ks+j4VcE2QMtHTn7RCid3ANTNgjCWM wuLxuI7SBhlOQpBlI/kLdXlNxbCNAdg= 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-Rspamd-Queue-Id: 31CD6160019 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: q45xfickp8jeo9b1bopzz9dceqhfnbpw X-HE-Tag: 1689171918-616932 X-HE-Meta: U2FsdGVkX18WnTVXjjBHCCxYku/mugJYyGmyzLLVpd3g7hkKBXsBWIlkTmuv7P5fku9mtatAxcdZb5MX+htUzqtEQpFJ9ZuDF++WA0213pmhwuC7jEWmiEHfvjk94JiMvwI18kl7PCeMNqyE5XiMMSwMLIVfGqdIZ4O5hpIqZIQ6Q78uRMHak2Lso1D3JfjkRI7Ivp5PnlT5NB4GgJDgYhJ+UJ35BknGYldyKqqyFvIT2mDFwl2sm1lEZ1hlk8OJ5q7keOQcbc644W0FIOe6MmZDV+96BA62JRto5wX/dRpVbSk6Vvbi4o+/Z8GwtKXpxk/+tPOTSm6cLh0gQ4hSwvZt3ZgW9Xv5eRgtP+oayb9VAwZIUxSHpRimAHGYfDH/HqEStK8k8RXGMj8A6aewo9IfT8xLa5/aOSN4DGgSsTcfyF3xxzfDt7W88wEp9xmsfCY+j8x1iC9HeFBNg4dh9fkjAu0j0YtdPBTNICo7ltH64hAO6876lPHH1bPl55zlUvn3k7DUes7vCl9Yst5UNdGyY7ilQAWbBo7glsPMfx5vvP/Fdb90RzPJCrGYypQMTFrlwDiQiuaG4oIBPxLg/b8XBoU5zeqB2DWLi7rPWqBUB8FvOBts3pPmc+77hgCQs3NSXKtYPdKF6nC3JOiDyo1PjVr4lLo+mNJ6ONAy608LDRXMsZolF8SbyO3gLgH1D7DwSn7pgrIxtXxJ6JVbc+KzUg541EkoXU2m3i27bG/5dait7X8YyZm5PAPhhGHhgluUy2vxmd+5t5qWWQiiiF0H4y9yA8EMjpWpE22WitJsyOy9GZujbp8biYsEVeq0U95Xik7P+dh0rLU1xOcfbCZ4C3If7LlY1G6/vt8fDYGzlyWsv8sndYqcPdZhNJQTKx4ChP/4P82mqRWjQoRqseZV3d1bJYK2i+CROj5NQHGWVnRNhDesWk8JPhnViohV4cv4OIC+A94Kuk95tvK c1gKSVg2 bbPvG+bSGLX4kvUKERkpJ5XDl+h8lvEiGhy/qyHMYx2KGMls/m7rmqF+oV5DrcG/3iZ92FPLwqQN3SHPoso6sYDvtPSPvNMCuavkJH51lljQ6PWXgX7w/2hgE8bzG2y/Ys1y4QJ8LoULF08SekpqagJzH9nK3PvpsHQdMxwyXP7OKXjJFIknRALCsaX1/NkOB4Ix3 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. 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: