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-Tag: 1689171920-597014 X-HE-Meta: U2FsdGVkX18xuaGU+OMrkfBkNLfstM3Ypd0BnAa8My33Sb4M1JOB1Iee52XklII2S4cD4NiklV1rqzp0rGRx1QPkDMEcdsifdv2/XoPzVSobNBpwHzq3+i9li5MQPGGvy/XO6lr18YtaMug5F+te5gLs+bRDkHnRJGwXEclhZ5rHpaEQ4EmYMaS3FhV77DM4yxR/sdIgt269q4TOTri2gdvdV3EvMagjgd1utrqwDJDb0MknYsYAd4MGkwcKZuUoqU/03zF7z9xoEAnxWP+1X6mcEaXO2DxnSn1Ahtcbjwi7KeL/knuzYFEHWF6Kqmfq2M8jfuTsihqFn9jLNkJW0/K000THg3FZUhC8/1boJVXzSZGRiwxODtk5qS9BGN+rRnPxJq5vWw5SlnGlugD+j/jnirokyzA49kkcTtd4EMs5K7i4X7/MO2UqS1MajZMmI+VYtbTi8HLBMvnuW6CGPjv1AitUpPkHyOdYEdwCTVlgfPORPg551s3NKdmuzm2TKH9TEH3P+6TGByTwUKLCDKOoiKJjCmCJU2y6YcbkvMFr6TvHlGiQdpQI0LuITlke4/BpWA/UMWqrkWlvOwyV2faTqgZxqD49pRGM9Sv8ZQ0x+PefZe+F/GvJEx0CFRy6/4rk8VKI/C6Epe9eT7foj28/fPud/hShkOhQxl4ybwVmOc6BVn5/YtPp/HVDYouz3whagpt76Hf1Ye6yhmf4nXJuFBZOAzDmlE8NU+1Qx9/cxOTEV/dAS+PuNvB/1+laNS26BIo4CRzEJCLi7hDnJTT1GrlUAPdhGmns+rsXCujX7D8DqDq6An3BR+nDjCnqaMqMcCWWXrty4M6CNEYOjTZdW4LyBeIWvM3MI9SNOzqqYx6wYGaZ402eC78iiGP2XkKl/llZbTjkpIs7OtnIhDwGg51lSpUiM75dDVEZRPx9Y7Pf/ZJ5/cVUzuw9Bp6XoFXP80h5Fm8xXewNsau 3gDSe1nS MgXe9a4LFUZiHKYZiqMMO2cfrZjJ1eyP3qP2dVCATYW+hQRxrEipSL8FTTa2FigEOKy5WRiHnbgzF1iuv0s7iT6HaJQ+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));