From patchwork Wed Jul 12 14:38:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13310441 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 C80A9EB64DD for ; Wed, 12 Jul 2023 14:25:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 900726B0074; Wed, 12 Jul 2023 10:25:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8A1D46B007B; Wed, 12 Jul 2023 10:25:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 690136B0074; Wed, 12 Jul 2023 10:25:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 489F86B0074 for ; Wed, 12 Jul 2023 10:25:23 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D0BA21402A7 for ; Wed, 12 Jul 2023 14:25:22 +0000 (UTC) X-FDA: 81003182484.14.D619071 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf24.hostedemail.com (Postfix) with ESMTP id 52E9F180021 for ; Wed, 12 Jul 2023 14:25:19 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf24.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 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=VukWvuARBZOA/5hNtQJy/8P0HiOUMe+fpQcknK4J+eOU2kAyFvKa+eVtaHNc+VqI21DXMH wsQb8ZG59QHESmV33bp8wVZquXEe6DbRl6t+VhOeV+RNbKTmlKdSDoihQw+bbGZ1wtTMgU 1uBkGAi00+FSWdeV2H6lyl4x0noIErY= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf24.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 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=AaYvLkQ+uQN/4z0R/trQTRcmsMOzJt2xdEyLPnUlQFs=; b=JizAJMKazrPRW+nVyAY44rMkeTaZum6VdGCB9/A67H/KKzSkoom0NQL4apJ1SN5WkM3h3m BJ9KoFPrApuBE+gkSkH2AWDxBm1m7/G2Pcaqqi8TT8V1LYXYr7nfWpSXrf3df+0LvJ3hQF P4c4ZB9Tmy9yo0IkAkknZM4Wq+deHno= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R1KhX4dLLzPkCX; Wed, 12 Jul 2023 22:22:52 +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:12 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , , , Kefeng Wang Subject: [PATCH 1/5] mm: introduce vma_is_stack() and vma_is_heap() Date: Wed, 12 Jul 2023 22:38:27 +0800 Message-ID: <20230712143831.120701-2-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-Server: rspam08 X-Rspamd-Queue-Id: 52E9F180021 X-Stat-Signature: s3ma4qwyr6towj8691d3hfdpc53amfhe X-Rspam-User: X-HE-Tag: 1689171919-91679 X-HE-Meta: U2FsdGVkX1/MtP499IVdIupM/SqjB9VWnvQLn6xHQMZC/Hl70fKWJQhBSrT9jUwCqZj+JD5FTHXVeY/WiEYxghP5fVyiLN+pNEZOfr13/quOB4KO2INj9BsquPeLnZ1cb+/v29SXHO0aB4fhPbjxl87UHlQ97Itiqc7gA0tVp5LEbJUa13OEEAKval8LvHzrNdfAz5mK7sGQN77l4Y9M+7YV/+rODfePfhb9HstNFtA9fkqzfcti2Im/m2ji1cXsqysCY2MRvWURTD9O4OserC2lnWGh/1JOnS7ABfKNardN3OCZZjlg8h7BmMxOxiZuUldYkvZ2zwcEQDoxYfxJyqEMbHAp/Gp7RQbrwbh1WmnDRBbI7NRsm7fc9xC40Q1MYeE64fko/2t0hdyS+GsLwXNOGbqrKJB0x7dIW/Nc1u4zRpwto/M4yk+A7HKGh6oNGWZGMIgOj5sDDyAZxtk2jNA1G/dS7yrt/V/cJ9nx3YCE3FP4PQ4t6laXbkaWoJ+ezPrVcfYWW8RQ0n5vqn/4JYsIb6dDETObw9Y4yc9agPgFR9YnignOPjdfwp6U76SdRtIausO+Ei5R4blRfem497VOvqE6vEP8W8gXTLuZAJcdPgWylbsyi8T/Wm5lwet47mXr07qnqEdixnzBENKHoL2MY70J5x7Qj74Ru4hg6+P39bMSoknfB5nfcZl535kHB3/YPliOEF+iwT+348EtSgyjtcG8eUruGYIJerjl169yE/jm37f7WpJDZbeNlIxhH039n8g80DeTCPGBt8U7cUe9Dxq31AgUFd4IeZav971D1+7FRGQMh7xJ56N938ahrtmppyXtmZVNmSAripXLJ283xpUoOsIiHxloEMvekk89hhGBHNc/7AtJMGHT3GZf7XPsg4OQaSSqkan2LFZRTDMcmoh2DXiTqZ7l3TP2GovmCPPrNSudRMnWHkVJei3kZYOyFtJqJBSnR41n2sU 5Usm2S55 4WTkSkuRrSIxuDtSulZe7BDl9h2QSo7A1+wE7Fz2EqvUEyZWrTBeCrTv7R0NVk+E9/1dhT4VqaYLaYL/GRzwKBilg/C+ZmHoFlLf9NyPeo0IpmOEUtOkksDeBwrCesWSVSlT8PS1gdWvUU1asAllkvM0axjA/DT5I1Qa2cMNiLAUbpzdgKKSkCiATLxW0hRZz11pr 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: Introduce the two helpers for general use. Signed-off-by: Kefeng Wang --- include/linux/mm.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index 1462cf15badf..0bbeb31ac750 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -926,6 +926,18 @@ static inline bool vma_is_anonymous(struct vm_area_struct *vma) return !vma->vm_ops; } +static inline bool vma_is_heap(struct vm_area_struct *vma) +{ + return vma->vm_start <= vma->vm_mm->brk && + vma->vm_end >= vma->vm_mm->start_brk; +} + +static inline bool vma_is_stack(struct vm_area_struct *vma) +{ + return vma->vm_start <= vma->vm_mm->start_stack && + vma->vm_end >= vma->vm_mm->start_stack; +} + static inline bool vma_is_temporary_stack(struct vm_area_struct *vma) { int maybe_stack = vma->vm_flags & (VM_GROWSDOWN | VM_GROWSUP); From patchwork Wed Jul 12 14:38:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13310442 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 448D7C04E69 for ; Wed, 12 Jul 2023 14:25:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 690FC6B0075; Wed, 12 Jul 2023 10:25:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 640FF6B007D; Wed, 12 Jul 2023 10:25:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4450A6B0078; Wed, 12 Jul 2023 10:25:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 35D1B6B0074 for ; Wed, 12 Jul 2023 10:25:23 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D66451C8185 for ; Wed, 12 Jul 2023 14:25:22 +0000 (UTC) X-FDA: 81003182484.15.E29EDA6 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf22.hostedemail.com (Postfix) with ESMTP id ACCFFC0006 for ; Wed, 12 Jul 2023 14:25:18 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689171921; a=rsa-sha256; cv=none; b=SxE2gb88Eeo2c8CxpqxHl6rgxSL3s+W9ZsXh55ZBUzcXEXkMIkRyxDraaEAT6WdxPVJdAO /RPuPwpLg0EEAOBML45XM1hGSM/qgwRdZcrO53Sd4lb6sDC2oKx3EP7rSqYK4ry+BY2O/m 7aGoi4sb/f0lX6XzAKUaj8/0CM41Z3Q= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=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=i32xQsYNea2N3mRh+W5pA/MWZrgbJQEJwx4pUovWufk=; b=uhewK0RXyK+TJGvFpPnX9h2rVHzx7SpcW5ZLSA468QnfaGX2E9eMoABM70tmzPpBR7Krwf C7uaYVYlqWHJs6P4QZN2CfM7ubCRaoAi5VvnxjqlVfp/jdGmg+7op+ZLgIyMz+XXoeo+dj 3TQPACSaF9McEnB1I+86RNo6aLu/NUA= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R1KgS2xkDzMqYD; Wed, 12 Jul 2023 22:21:56 +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:12 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , , , Kefeng Wang Subject: [PATCH 2/5] mm: use vma_is_stack() and vma_is_heap() Date: Wed, 12 Jul 2023 22:38:28 +0800 Message-ID: <20230712143831.120701-3-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-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: ACCFFC0006 X-Stat-Signature: y68w55d86s4mhxwxhcqzjwed8xm33o6c X-HE-Tag: 1689171918-636894 X-HE-Meta: U2FsdGVkX19duWbGDoT3l+Tn9M1uv/GKQ8repeQs8JRrgmpDFB7TAYFEolLJn4uF11LAk3hWeXDd0tVTMME7A0X+lwlljXNnDnxbd9GSxJSU3fvJSAT6Kd/wpWLAfEM/fDVVsGmhqtbHQ1Vcj3pxGSf2O/Dk/QRiHaqgs9M4n6SYpZe85ZgHvhKhAMYLrSNZUeF7tvUrpSiMNj6We2okwoJn8Jq82sEPkWM5oud3Aoa9aYflXQA6WjMc5T1INiXGUhNiXsGzcHFk6HoyH560Um4IKWy6IEcHB/6jdEcF6UblFbp7kWeit+filisMPF1Wt/Bo0ulKkF36avKbSd5QJtnHLriHGCJmYEsT4swKk/UxmTTK/pNeKhuar91rSNn4HpOmp3KGWiseRn8YwZxwSguOZ+JyPLK15cGOjGRnsmoLy1ju7dUKNtEcqa4YrYxcgOBLJ5vcuhiGDD5LL61vSZufQEJmUO6T9vUqrMZDhvvDMugQNGXjYv/8dUPGeYmJZHUGsMzngrAyORTZW8/iux+rTEThBRnJI0msZRL6thwG3423cMUr7ltbR2YgdlTqDAPvoc9vhUYpvrd2tcDAEVJvwNwKoF97WU5VrfWVexFi/dISRyJWGvD3n+MyjsfePO1bzfXmqGygqNkPfvLUoYAaHzrU/IaflIB+qUBkypM5nIP7U50PHuZusLi1AX5CaaKvD+DiyF69+SH/y68KMIxbLcE9yVZdSztiCF63ztUzK1w6dicuh7/rJon2MArjvjJQ7i5/Nh+1KhJAovXUVR7COP12V/rS+w77nEzyudd2d57zrtv7o5exZAxFkPVy6CWoePECzb4xWHQPm0N4IYqDSnyGn4F70nbfX5TRG/LIDDcR0xGhIaa6yMdtYEyeAvAIejo/2N7Q8ZX4if6fDm5bz50vHR6xdVj5aUiWN8hHaQZNPzUEvjgL41GzCpAowuPuRXl3/zk1ggzMzwZ clq2OE68 Ws5PK6tZpNZboCt+8Ukc7phPPTknlVXpQLN9lPYIEN6Qa4VW9AhCSZohyihYgo7wNRK6ZahCv4x67BZtkShEp2GIZAfOow1CP1byFEp78gdFLtuh3MdOFBHiMkNtZOmgMN9RBGoUPgvZxjmCOswnPR13AnSho2B5V0BitwN1GoVWA4pjYyJFHMXasuf8sBH/vro94 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. Signed-off-by: Kefeng Wang --- fs/proc/task_mmu.c | 24 ++++-------------------- fs/proc/task_nommu.c | 15 +-------------- 2 files changed, 5 insertions(+), 34 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index cfab855fe7e9..05e9893552ce 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -236,21 +236,6 @@ static int do_maps_open(struct inode *inode, struct file *file, sizeof(struct proc_maps_private)); } -/* - * Indicate if the VMA is a stack for the given task; for - * /proc/PID/maps that is the stack of the main task. - */ -static int is_stack(struct vm_area_struct *vma) -{ - /* - * We make no effort to guess what a given thread considers to be - * its "stack". It's not even well-defined for programs written - * languages like Go. - */ - return vma->vm_start <= vma->vm_mm->start_stack && - vma->vm_end >= vma->vm_mm->start_stack; -} - static void show_vma_header_prefix(struct seq_file *m, unsigned long start, unsigned long end, vm_flags_t flags, unsigned long long pgoff, @@ -327,13 +312,12 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma) goto done; } - if (vma->vm_start <= mm->brk && - vma->vm_end >= mm->start_brk) { + if (vma_is_heap(vma)) { name = "[heap]"; goto done; } - if (is_stack(vma)) { + if (vma_is_stack(vma)) { name = "[stack]"; goto done; } @@ -1974,9 +1958,9 @@ static int show_numa_map(struct seq_file *m, void *v) if (file) { seq_puts(m, " file="); seq_file_path(m, file, "\n\t= "); - } else if (vma->vm_start <= mm->brk && vma->vm_end >= mm->start_brk) { + } else if (vma_is_heap(vma)) { seq_puts(m, " heap"); - } else if (is_stack(vma)) { + } else if (vma_is_stack(vma)) { seq_puts(m, " stack"); } diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c index 2c8b62265981..f42c84172b9e 100644 --- a/fs/proc/task_nommu.c +++ b/fs/proc/task_nommu.c @@ -121,19 +121,6 @@ unsigned long task_statm(struct mm_struct *mm, return size; } -static int is_stack(struct vm_area_struct *vma) -{ - struct mm_struct *mm = vma->vm_mm; - - /* - * We make no effort to guess what a given thread considers to be - * its "stack". It's not even well-defined for programs written - * languages like Go. - */ - return vma->vm_start <= mm->start_stack && - vma->vm_end >= mm->start_stack; -} - /* * display a single VMA to a sequenced file */ @@ -171,7 +158,7 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma) if (file) { seq_pad(m, ' '); seq_file_path(m, file, ""); - } else if (mm && is_stack(vma)) { + } else if (mm && vma_is_stack(vma)) { seq_pad(m, ' '); seq_puts(m, "[stack]"); } From patchwork Wed Jul 12 14:38:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13310444 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 B7F81EB64DA for ; Wed, 12 Jul 2023 14:25:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9A1646B0080; Wed, 12 Jul 2023 10:25:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 83D316B007E; Wed, 12 Jul 2023 10:25:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 669586B0080; Wed, 12 Jul 2023 10:25:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 39BCD6B007D for ; Wed, 12 Jul 2023 10:25:24 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id DFB9F401BE for ; Wed, 12 Jul 2023 14:25:23 +0000 (UTC) X-FDA: 81003182526.03.87AB904 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf29.hostedemail.com (Postfix) with ESMTP id 9E26D12001F for ; Wed, 12 Jul 2023 14:25:20 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689171921; 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=ETNPB7wUh0SNwnx9DDYb/PlWZoZqHTNfB+0DsPV8JQI=; b=sHj1Yli/w0XMEawPfZPk+htXcFs7kMaVOYhvKUDijiKqkuudEeZ69TDDciDJ5dwg222z2q LGvnCpl4sJnPVzegdD0eV29YOWoY22Xd1rmPbZPYsCkAommG3zbhNT+Sb25zi90SVPHSgN gz9zaA18BuQLunziBIBcWkPW8kERy1A= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689171921; a=rsa-sha256; cv=none; b=vJVEK7VaiP7tM1Osf99ZFUS9OIR0NMf+aWG40Rb4SyG6G9RYzh/Ejykp9dZpR8UpCBwfJV EU0Ld0OftqYAX5jgPWivhZed5yHDOOG4xEMdKl8chLG/Vm6o0KfqmwU5rKf1oLRLqVOYpd N74sDLkkNxr+khRDgI4zFIPAopGv6LY= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R1Kkb0rdCz1JCP8; Wed, 12 Jul 2023 22:24:39 +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:13 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , , , Kefeng Wang Subject: [PATCH 3/5] drm/amdkfd: use vma_is_stack() and vma_is_heap() Date: Wed, 12 Jul 2023 22:38:29 +0800 Message-ID: <20230712143831.120701-4-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: 9E26D12001F X-Rspam-User: X-Stat-Signature: o6m3t7oaiab1k1okmrzqan9jet3wu1zc X-Rspamd-Server: rspam01 X-HE-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Ky5WRiHnbgzF1iuv0s7iT6HaJQ+GBXg2HoR1fxrzaUd0Cv7eeC+p+QG6hCbM7ouhlGVHwuI8bEQ3iHmj7g177dLqw1sywATBL0gw8Hnja0gLn7HX3Zugx3pKKMg77zCBrEaM 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. Signed-off-by: Kefeng Wang --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c index 479c4f66afa7..19ce68a7e1a8 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c @@ -2623,10 +2623,7 @@ svm_range_get_range_boundaries(struct kfd_process *p, int64_t addr, return -EFAULT; } - *is_heap_stack = (vma->vm_start <= vma->vm_mm->brk && - vma->vm_end >= vma->vm_mm->start_brk) || - (vma->vm_start <= vma->vm_mm->start_stack && - vma->vm_end >= vma->vm_mm->start_stack); + *is_heap_stack = vma_is_heap(vma) || vma_is_stack(vma); start_limit = max(vma->vm_start >> PAGE_SHIFT, (unsigned long)ALIGN_DOWN(addr, 2UL << 8)); From patchwork Wed Jul 12 14:38:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13310443 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 25AE9EB64D9 for ; Wed, 12 Jul 2023 14:25:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 44D6A6B0078; Wed, 12 Jul 2023 10:25:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3824F6B007B; Wed, 12 Jul 2023 10:25:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1AF2C6B007D; Wed, 12 Jul 2023 10:25:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0801A6B0078 for ; Wed, 12 Jul 2023 10:25:24 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id EA16DA0284 for ; Wed, 12 Jul 2023 14:25:21 +0000 (UTC) X-FDA: 81003182442.26.11EE8B7 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf15.hostedemail.com (Postfix) with ESMTP id D1B39A000B for ; Wed, 12 Jul 2023 14:25:18 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=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=cog3zFED0zqk0ayh/5AST+3VWG2EFfyBo0064QrevtA=; b=Zeayep7Zyfi0mEV+mwPniZWf/a+xQe0rKNVB+aI5gHCM9vF6eLEbUsrsF0h5ZQLd8cXtzO fOjexsTd1Z8exSNDYGrdbru3AGla4R9AJu8IXfRa1f9cZuj84RWeSdr+Mt6gMaOkYiwLFa LbedRxPKDfpwQM4CusOm5ZP+59Fb9Ks= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689171920; a=rsa-sha256; cv=none; b=Jl7er80mRVCPo7p2yYfzMYAcV5GW97la/5fxtY7MAAbHMG/VVvJA7uJQtD301ax8lw4tGO iI9JJPzYtVExaLUcDXJ1JsmtpEqY4ZoE//CrrjqKTqdedtdRkAUJFiP2/8PScti65MuXRL 2TVTlUuXAonQiFIBGMHemQa4o7n7SZc= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R1KhZ0q0bzPk8H; Wed, 12 Jul 2023 22:22:54 +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:13 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , , , Kefeng Wang Subject: [PATCH 4/5] selinux: use vma_is_stack() and vma_is_heap() Date: Wed, 12 Jul 2023 22:38:30 +0800 Message-ID: <20230712143831.120701-5-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: D1B39A000B X-Rspam-User: X-Stat-Signature: p87wqzhhtipt3jht5g3icgxg4j8zuau5 X-R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+rLWUR8eolrdoNsMRD7oyKS8EEKzxkJyKyT6lRpHfbR8/e4gSW5omhF9DWjH6getyNiduhIc9R5/CWjnms+Z49vgpkupPOnOX1gzZsdYY8tH4ZK+7Lx/kVwetMyzsyJpZzmzGySpm3V 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. Signed-off-by: Kefeng Wang Acked-by: Paul Moore --- security/selinux/hooks.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 4e46cf3d67b6..289ef2d6a427 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -3775,13 +3775,10 @@ static int selinux_file_mprotect(struct vm_area_struct *vma, if (default_noexec && (prot & PROT_EXEC) && !(vma->vm_flags & VM_EXEC)) { int rc = 0; - if (vma->vm_start >= vma->vm_mm->start_brk && - vma->vm_end <= vma->vm_mm->brk) { + if (vma_is_heap(vma)) { rc = avc_has_perm(sid, sid, SECCLASS_PROCESS, PROCESS__EXECHEAP, NULL); - } else if (!vma->vm_file && - ((vma->vm_start <= vma->vm_mm->start_stack && - vma->vm_end >= vma->vm_mm->start_stack) || + } else if (!vma->vm_file && vma_is_stack(vma) || vma_is_stack_for_current(vma))) { rc = avc_has_perm(sid, sid, SECCLASS_PROCESS, PROCESS__EXECSTACK, NULL); 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: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2 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: